(t *testing.T)
| 105 | } |
| 106 | |
| 107 | func TestReplaceCallsPush(t *testing.T) { |
| 108 | mkObj := func(name string, val interface{}) testUndeltaObject { |
| 109 | return testUndeltaObject{name: name, val: val} |
| 110 | } |
| 111 | |
| 112 | var got []interface{} |
| 113 | var callcount int = 0 |
| 114 | push := func(m []interface{}) { |
| 115 | callcount++ |
| 116 | got = m |
| 117 | } |
| 118 | |
| 119 | u := NewUndeltaStore(push, testUndeltaKeyFunc) |
| 120 | |
| 121 | m := []interface{}{mkObj("a", 1)} |
| 122 | |
| 123 | u.Replace(m, "0") |
| 124 | if callcount != 1 { |
| 125 | t.Errorf("Expected 1 calls, got %d", callcount) |
| 126 | } |
| 127 | expected := []interface{}{mkObj("a", 1)} |
| 128 | if !reflect.DeepEqual(expected, got) { |
| 129 | t.Errorf("Expected %#v, Got %#v", expected, got) |
| 130 | } |
| 131 | } |
nothing calls this directly
no test coverage detected