mirror of
https://github.com/octoleo/restic.git
synced 2024-12-22 10:58:55 +00:00
forget: Fail test if duration parsing error is missing
This commit is contained in:
parent
6f517858e8
commit
bb27f7408c
@ -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.
|
||||
|
||||
https://github.com/restic/restic/issues/3861
|
||||
https://github.com/restic/restic/pull/3862
|
||||
|
@ -83,9 +83,15 @@ func TestParseDuration(t *testing.T) {
|
||||
for _, test := range tests {
|
||||
t.Run("", func(t *testing.T) {
|
||||
d, err := ParseDuration(test.input)
|
||||
if err != nil && !test.err {
|
||||
if test.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) {
|
||||
t.Error(cmp.Diff(test.d, d))
|
||||
|
Loading…
Reference in New Issue
Block a user