(t *testing.T)
| 68 | } |
| 69 | |
| 70 | func TestDeleteCallsPush(t *testing.T) { |
| 71 | mkObj := func(name string, val interface{}) testUndeltaObject { |
| 72 | return testUndeltaObject{name: name, val: val} |
| 73 | } |
| 74 | |
| 75 | var got []interface{} |
| 76 | var callcount int = 0 |
| 77 | push := func(m []interface{}) { |
| 78 | callcount++ |
| 79 | got = m |
| 80 | } |
| 81 | |
| 82 | u := NewUndeltaStore(push, testUndeltaKeyFunc) |
| 83 | |
| 84 | u.Add(mkObj("a", 2)) |
| 85 | u.Delete(mkObj("a", "")) |
| 86 | if callcount != 2 { |
| 87 | t.Errorf("Expected 2 calls, got %d", callcount) |
| 88 | } |
| 89 | expected := []interface{}{} |
| 90 | if !reflect.DeepEqual(expected, got) { |
| 91 | t.Errorf("Expected %#v, Got %#v", expected, got) |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | func TestReadsDoNotCallPush(t *testing.T) { |
| 96 | push := func(m []interface{}) { |
nothing calls this directly
no test coverage detected