backend: use generic implementation for ParseConfig tests

This commit is contained in:
Michael Eischer
2023-04-20 23:02:56 +02:00
parent 5260d38980
commit fa361dbfbd
9 changed files with 88 additions and 157 deletions

View File

@@ -1,11 +1,12 @@
package gs
import "testing"
import (
"testing"
var configTests = []struct {
s string
cfg Config
}{
"github.com/restic/restic/internal/backend/test"
)
var configTests = []test.ConfigTestData[Config]{
{"gs:bucketname:/", Config{
Bucket: "bucketname",
Prefix: "",
@@ -27,17 +28,5 @@ var configTests = []struct {
}
func TestParseConfig(t *testing.T) {
for i, test := range configTests {
cfg, err := ParseConfig(test.s)
if err != nil {
t.Errorf("test %d:%s failed: %v", i, test.s, err)
continue
}
if cfg != test.cfg {
t.Errorf("test %d:\ninput:\n %s\n wrong config, want:\n %v\ngot:\n %v",
i, test.s, test.cfg, cfg)
continue
}
}
test.ParseConfigTester(t, ParseConfig, configTests)
}