2
2
mirror of https://github.com/octoleo/restic.git synced 2024-06-13 22:32:21 +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 ( import (
"fmt" "fmt"
"reflect" "reflect"
"regexp"
"testing" "testing"
"time" "time"
) )
@ -199,7 +200,7 @@ var invalidSetTests = []struct {
"timeout": "2134", "timeout": "2134",
}, },
"ns", "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) t.Fatalf("expected error %v not found", test.err)
} }
if err.Error() != test.err { matched, err := regexp.MatchString(test.err, err.Error())
t.Fatalf("expected error %q, got %q", 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())
} }
}) })
} }