2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-25 22:27:35 +00:00

options: Fix test for Go >= 1.15

This commit is contained in:
Alexander Neumann 2020-09-12 17:36:44 +02:00
parent 59fca85844
commit 97950ab81a

View File

@ -3,6 +3,7 @@ package options
import (
"fmt"
"reflect"
"regexp"
"testing"
"time"
)
@ -199,7 +200,7 @@ var invalidSetTests = []struct {
"timeout": "2134",
},
"ns",
`time: missing unit in duration 2134`,
`time: missing unit in duration "?2134"?`,
},
}
@ -212,8 +213,13 @@ func TestOptionsApplyInvalid(t *testing.T) {
t.Fatalf("expected error %v not found", test.err)
}
if err.Error() != test.err {
t.Fatalf("expected error %q, got %q", test.err, err.Error())
matched, err := regexp.MatchString(test.err, err.Error())
if err != nil {
t.Fatal(err)
}
if !matched {
t.Fatalf("expected error to match %q, got %q", test.err, err.Error())
}
})
}