(cs *Changeset[T], expectMatch bool, t *testing.T)
| 123 | } |
| 124 | |
| 125 | func expectValuesAndChanges[T any](cs *Changeset[T], expectMatch bool, t *testing.T) { |
| 126 | diffLength := len(cs.Changes) != len(cs.Values) |
| 127 | if expectMatch && diffLength { |
| 128 | t.Errorf("Expected Changes and Values match=%v, got %d and %d", expectMatch, len(cs.Changes), len(cs.Values)) |
| 129 | } |
| 130 | if !expectMatch && !diffLength { |
| 131 | t.Errorf("Expected Changes and Values match=%v, got %d and %d", expectMatch, len(cs.Changes), len(cs.Values)) |
| 132 | } |
| 133 | for k, v := range cs.Changes { |
| 134 | if expectMatch && len(v) != len(cs.Values[k]) { |
| 135 | t.Errorf("Expected Changes to have same number of entries, got %v", cs.Changes) |
| 136 | } |
| 137 | for i, s := range v { |
| 138 | if s != cs.Values[k][i] { |
| 139 | t.Errorf("Expected matching entries for key %s, got %s and %s", k, s, cs.Values[k][i]) |
| 140 | } |
| 141 | } |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | func TestChangesOnEmptyInit(t *testing.T) { |
| 146 | cs := New[Person](&cc, nil) |
no outgoing calls
no test coverage detected