-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakers_test.go
More file actions
47 lines (35 loc) · 891 Bytes
/
makers_test.go
File metadata and controls
47 lines (35 loc) · 891 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package arrayr
import "testing"
func TestFrom(t *testing.T) {
test := From("a", "b", "c")
assrtEqual(t, []string{"a", "b", "c"}, test)
}
func TestFrom_Empty(t *testing.T) {
test := From[any]()
assrtEqual(t, 0, len(test))
assrtNotNil(t, test)
}
func TestFrom_Any(t *testing.T) {
test := From[any](1, "a", t)
assrtEqual(t, []any{1, "a", t}, test)
}
func TestFromMap(t *testing.T) {
test := FromMap(map[string]string{
"do": "a deer, a female deer",
"re": "a drop of golden sun",
"mi": "a name I call myself",
})
assrtEqual(t, 3, len(test))
for _, pair := range test {
switch pair.X {
case "do":
assrtEqual(t, "a deer, a female deer", pair.Y)
case "re":
assrtEqual(t, "a drop of golden sun", pair.Y)
case "mi":
assrtEqual(t, "a name I call myself", pair.Y)
default:
t.Fatalf(`unexpected values -- pair{X: "%s", Y: "%s"}`,pair.X,pair.Y)
}
}
}