-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
8dc7b4f
commit ac1b345
Showing
7 changed files
with
89 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,12 @@ stdout 'Ok' | |
! stderr . | ||
cmp entries/.github/workflows/gha.sum .want/gha.sum | ||
|
||
# Duplicate entries | ||
exec ghasum update -cache .cache/ -force duplicate/ | ||
stdout 'Ok' | ||
! stderr . | ||
cmp duplicate/.github/workflows/gha.sum .want/gha.sum | ||
|
||
# Error in headers | ||
exec ghasum update -cache .cache/ -force headers/ | ||
stdout 'Ok' | ||
|
@@ -28,6 +34,22 @@ stdout 'Ok' | |
! stderr . | ||
cmp no-version/.github/workflows/gha.sum .want/gha.sum | ||
|
||
-- duplicate/.github/workflows/gha.sum -- | ||
version 1 | ||
|
||
actions/[email protected] KsR9XQGH7ydTl01vlD8pIZrXhkzXyjcnzhmP+/KaJZI= | ||
actions/[email protected] KaJZI=/KsR9XQGH7ydTl01vlD8pIZrXhkzXyjcnzhmP+ | ||
-- duplicate/.github/workflows/workflow.yml -- | ||
name: Example workflow | ||
on: [push] | ||
|
||
jobs: | ||
example: | ||
name: example | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/[email protected] | ||
-- entries/.github/workflows/gha.sum -- | ||
version 1 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters