forked from joncalhoun/qson
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmerge_test.go
37 lines (34 loc) · 823 Bytes
/
merge_test.go
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
package qson
import "testing"
func TestMergeSlice(t *testing.T) {
a := []interface{}{"a"}
b := []interface{}{"b"}
actual := mergeSlice(a, b)
if len(actual) != 2 {
t.Errorf("Expected size to be 2.")
}
if actual[0] != "a" {
t.Errorf("Expected index 0 to have value a. Actual: %s", actual[0])
}
if actual[1] != "b" {
t.Errorf("Expected index 1 to have value b. Actual: %s", actual[1])
}
}
func TestMergeMap(t *testing.T) {
a := map[string]interface{}{
"a": "b",
}
b := map[string]interface{}{
"b": "c",
}
actual := mergeMap(a, b)
if len(actual) != 2 {
t.Errorf("Expected size to be 2.")
}
if actual["a"] != "b" {
t.Errorf("Expected key \"a\" to have value b. Actual: %s", actual["a"])
}
if actual["b"] != "c" {
t.Errorf("Expected key \"b\" to have value c. Actual: %s", actual["b"])
}
}