summaryrefslogtreecommitdiff
path: root/internal/backend/swift/config_test.go
diff options
context:
space:
mode:
authorFélix Sipma <felix+debian@gueux.org>2023-08-05 15:53:51 +0200
committerFélix Sipma <felix+debian@gueux.org>2023-08-05 15:57:51 +0200
commit03fcf0fc10f5c5a1e7d0f1f55bcd3e4ea5949036 (patch)
treebc3b128e615b5429a6ab4f49f75e8eaa902be428 /internal/backend/swift/config_test.go
parent8794b3d5a50ff126782a370e8a204c3da466a835 (diff)
New upstream version 0.16.0
Diffstat (limited to 'internal/backend/swift/config_test.go')
-rw-r--r--internal/backend/swift/config_test.go42
1 files changed, 13 insertions, 29 deletions
diff --git a/internal/backend/swift/config_test.go b/internal/backend/swift/config_test.go
index 35f091a9b..3e094f9ea 100644
--- a/internal/backend/swift/config_test.go
+++ b/internal/backend/swift/config_test.go
@@ -1,29 +1,30 @@
package swift
-import "testing"
+import (
+ "testing"
-var configTests = []struct {
- s string
- cfg Config
-}{
+ "github.com/restic/restic/internal/backend/test"
+)
+
+var configTests = []test.ConfigTestData[Config]{
{
- "swift:cnt1:/",
- Config{
+ S: "swift:cnt1:/",
+ Cfg: Config{
Container: "cnt1",
Prefix: "",
Connections: 5,
},
},
{
- "swift:cnt2:/prefix",
- Config{Container: "cnt2",
+ S: "swift:cnt2:/prefix",
+ Cfg: Config{Container: "cnt2",
Prefix: "prefix",
Connections: 5,
},
},
{
- "swift:cnt3:/prefix/longer",
- Config{Container: "cnt3",
+ S: "swift:cnt3:/prefix/longer",
+ Cfg: Config{Container: "cnt3",
Prefix: "prefix/longer",
Connections: 5,
},
@@ -31,24 +32,7 @@ var configTests = []struct {
}
func TestParseConfig(t *testing.T) {
- for _, test := range configTests {
- t.Run("", func(t *testing.T) {
- v, err := ParseConfig(test.s)
- if err != nil {
- t.Fatalf("parsing %q failed: %v", test.s, err)
- }
-
- cfg, ok := v.(Config)
- if !ok {
- t.Fatalf("wrong type returned, want Config, got %T", cfg)
- }
-
- if cfg != test.cfg {
- t.Fatalf("wrong output for %q, want:\n %#v\ngot:\n %#v",
- test.s, test.cfg, cfg)
- }
- })
- }
+ test.ParseConfigTester(t, ParseConfig, configTests)
}
var configTestsInvalid = []string{