github.com/mckael/restic@v0.8.3/internal/backend/azure/config_test.go (about) 1 package azure 2 3 import "testing" 4 5 var configTests = []struct { 6 s string 7 cfg Config 8 }{ 9 {"azure:container-name:/", Config{ 10 Container: "container-name", 11 Prefix: "", 12 Connections: 5, 13 }}, 14 {"azure:container-name:/prefix/directory", Config{ 15 Container: "container-name", 16 Prefix: "prefix/directory", 17 Connections: 5, 18 }}, 19 {"azure:container-name:/prefix/directory/", Config{ 20 Container: "container-name", 21 Prefix: "prefix/directory", 22 Connections: 5, 23 }}, 24 } 25 26 func TestParseConfig(t *testing.T) { 27 for i, test := range configTests { 28 cfg, err := ParseConfig(test.s) 29 if err != nil { 30 t.Errorf("test %d:%s failed: %v", i, test.s, err) 31 continue 32 } 33 34 if cfg != test.cfg { 35 t.Errorf("test %d:\ninput:\n %s\n wrong config, want:\n %v\ngot:\n %v", 36 i, test.s, test.cfg, cfg) 37 continue 38 } 39 } 40 }