Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test and document behavior of sumfiles with duplicate entries #39

Merged
merged 2 commits into from
Mar 23, 2024

Commits on Mar 23, 2024

  1. Test and document behavior of sumfiles with duplicate entries

    Add tests that verify the `ghasum update` and `ghasum verify` commands
    both reject sumfiles with duplicate (non-header) entries. Additionally
    test that `ghasum update -force` fixes duplicate (non-header) entries.
    To support this change some test re-organization was in order. The pre-
    existing "invalid sumfile" tests were specifically testing against a
    sumfile with a syntax error, hence these have been renamed (given the
    new tests are also for an "invalid sumfile").
    
    Additionally, the implementation for sumfile parsing has been updated to
    improve the error messages produced, which are asserted in the new and
    changed tests. Similarly, the `SPECIFICATION.md` is updated to make
    explicit that duplicate sumfile entries should be rejected.
    
    As an aside, this uncovered a off-by-one bug in the line number formula
    in the implementation for sumfile parsing and corresponding incorrectly
    implemented unit test - both of which are fixed here.
    ericcornelissen committed Mar 23, 2024
    Configuration menu
    Copy the full SHA
    d30103a View commit details
    Browse the repository at this point in the history
  2. Test and document behavior of sumfiles with duplicate headers

    Add tests that verify the `ghasum update` and `ghasum verify` commands
    both reject sumfiles with duplicate headers. To support this change some
    test re-organization was in order. The existing "Sumfile with ..." tests
    were specifically testing against problems with (non-header) entries but
    now there are (separate) tests for problems with headers and entries.
    Also, duplicate headers are unit tested for regardless of the sumfile
    version.
    
    The behavior of `ghasum update -force` is not covered here because there
    is currently no defined behavior for what `ghasum update` should do with
    headers.
    
    Additionally, the implementation for sumfile parsing has been updated to
    improve the error messages produced, which are asserted in the new and
    changed tests. Similarly, the `SPECIFICATION.md` is updated to make
    explicit that duplicate headers in a sumfile should be rejected.
    
    As an aside, this (also) uncovered a off-by-one bug in the line number
    formula in the implementation for sumfile header parsing which is fixed
    here as well.
    ericcornelissen committed Mar 23, 2024
    Configuration menu
    Copy the full SHA
    15dca79 View commit details
    Browse the repository at this point in the history