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