1
2
3
4
5 package str
6
7 import "testing"
8
9 var foldDupTests = []struct {
10 list []string
11 f1, f2 string
12 }{
13 {StringList("math/rand", "math/big"), "", ""},
14 {StringList("math", "strings"), "", ""},
15 {StringList("strings"), "", ""},
16 {StringList("strings", "strings"), "strings", "strings"},
17 {StringList("Rand", "rand", "math", "math/rand", "math/Rand"), "Rand", "rand"},
18 }
19
20 func TestFoldDup(t *testing.T) {
21 for _, tt := range foldDupTests {
22 f1, f2 := FoldDup(tt.list)
23 if f1 != tt.f1 || f2 != tt.f2 {
24 t.Errorf("foldDup(%q) = %q, %q, want %q, %q", tt.list, f1, f2, tt.f1, tt.f2)
25 }
26 }
27 }
28
View as plain text