2
2
mirror of https://github.com/octoleo/restic.git synced 2024-05-29 23:20:49 +00:00

forget: Fail test if duration parsing error is missing

This commit is contained in:
Michael Eischer 2022-08-18 20:14:09 +02:00
parent 6f517858e8
commit bb27f7408c
2 changed files with 9 additions and 2 deletions

View File

@ -6,3 +6,4 @@ units in the duration options, such as e.g. `--keep-within-daily 2w`.
Specifying an invalid/unsupported duration unit now results in an error. Specifying an invalid/unsupported duration unit now results in an error.
https://github.com/restic/restic/issues/3861 https://github.com/restic/restic/issues/3861
https://github.com/restic/restic/pull/3862

View File

@ -83,8 +83,14 @@ func TestParseDuration(t *testing.T) {
for _, test := range tests { for _, test := range tests {
t.Run("", func(t *testing.T) { t.Run("", func(t *testing.T) {
d, err := ParseDuration(test.input) d, err := ParseDuration(test.input)
if err != nil && !test.err { if test.err {
t.Fatal(err) if err == nil {
t.Fatalf("Missing error for %v", test.input)
}
} else {
if err != nil {
t.Fatal(err)
}
} }
if !cmp.Equal(d, test.d) { if !cmp.Equal(d, test.d) {