* var ( o1 interface{} = t{1} o2 interface{} = t{2} l1 []interface{} = []interface{}{t{1}} ) */
(t *testing.T)
| 42 | */ |
| 43 | |
| 44 | func TestUpdateCallsPush(t *testing.T) { |
| 45 | mkObj := func(name string, val interface{}) testUndeltaObject { |
| 46 | return testUndeltaObject{name: name, val: val} |
| 47 | } |
| 48 | |
| 49 | var got []interface{} |
| 50 | var callcount int = 0 |
| 51 | push := func(m []interface{}) { |
| 52 | callcount++ |
| 53 | got = m |
| 54 | } |
| 55 | |
| 56 | u := NewUndeltaStore(push, testUndeltaKeyFunc) |
| 57 | |
| 58 | u.Add(mkObj("a", 2)) |
| 59 | u.Update(mkObj("a", 1)) |
| 60 | if callcount != 2 { |
| 61 | t.Errorf("Expected 2 calls, got %d", callcount) |
| 62 | } |
| 63 | |
| 64 | l := []interface{}{mkObj("a", 1)} |
| 65 | if !reflect.DeepEqual(l, got) { |
| 66 | t.Errorf("Expected %#v, Got %#v", l, got) |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | func TestDeleteCallsPush(t *testing.T) { |
| 71 | mkObj := func(name string, val interface{}) testUndeltaObject { |
nothing calls this directly
no test coverage detected