18 lines
331 B
Go
18 lines
331 B
Go
package regression
|
|
|
|
import "testing"
|
|
|
|
func TestToSetDeduplicates(t *testing.T) {
|
|
items := []string{"a", "b", "a", "c"}
|
|
s := toSet(items)
|
|
|
|
if len(s) != 3 {
|
|
t.Fatalf("expected 3 unique entries, got %d", len(s))
|
|
}
|
|
for _, key := range []string{"a", "b", "c"} {
|
|
if !s[key] {
|
|
t.Fatalf("expected key %q in set", key)
|
|
}
|
|
}
|
|
}
|