MCPcopy
hub / github.com/syncthing/syncthing / TestUniqueStrings

Function TestUniqueStrings

lib/stringutil/stringutil_test.go:13–51  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestUniqueStrings(t *testing.T) {
14 tests := []struct {
15 input []string
16 expected []string
17 }{
18 {
19 []string{"a", "b"},
20 []string{"a", "b"},
21 },
22 {
23 []string{"a", "a"},
24 []string{"a"},
25 },
26 {
27 []string{"a", "a", "a", "a"},
28 []string{"a"},
29 },
30 {
31 nil,
32 nil,
33 },
34 {
35 []string{" a ", " a ", "b ", " b"},
36 []string{"a", "b"},
37 },
38 }
39
40 for _, test := range tests {
41 result := UniqueTrimmedStrings(test.input)
42 if len(result) != len(test.expected) {
43 t.Errorf("%s != %s", result, test.expected)
44 }
45 for i := range result {
46 if test.expected[i] != result[i] {
47 t.Errorf("%s != %s", result, test.expected)
48 }
49 }
50 }
51}

Callers

nothing calls this directly

Calls 1

UniqueTrimmedStringsFunction · 0.85

Tested by

no test coverage detected