(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestStringSliceReplaceAt(t *testing.T) { |
| 10 | out, ok := stringSliceReplaceAt([]string{"abc", "foo", "bar", "bax"}, []string{"foo", "bar"}, []string{"baz"}, -1) |
| 11 | assert.Assert(t, ok) |
| 12 | assert.DeepEqual(t, []string{"abc", "baz", "bax"}, out) |
| 13 | |
| 14 | out, ok = stringSliceReplaceAt([]string{"foo"}, []string{"foo", "bar"}, []string{"baz"}, -1) |
| 15 | assert.Assert(t, !ok) |
| 16 | assert.DeepEqual(t, []string{"foo"}, out) |
| 17 | |
| 18 | out, ok = stringSliceReplaceAt([]string{"abc", "foo", "bar", "bax"}, []string{"foo", "bar"}, []string{"baz"}, 0) |
| 19 | assert.Assert(t, !ok) |
| 20 | assert.DeepEqual(t, []string{"abc", "foo", "bar", "bax"}, out) |
| 21 | |
| 22 | out, ok = stringSliceReplaceAt([]string{"foo", "bar", "bax"}, []string{"foo", "bar"}, []string{"baz"}, 0) |
| 23 | assert.Assert(t, ok) |
| 24 | assert.DeepEqual(t, []string{"baz", "bax"}, out) |
| 25 | |
| 26 | out, ok = stringSliceReplaceAt([]string{"abc", "foo", "bar", "baz"}, []string{"foo", "bar"}, nil, -1) |
| 27 | assert.Assert(t, ok) |
| 28 | assert.DeepEqual(t, []string{"abc", "baz"}, out) |
| 29 | |
| 30 | out, ok = stringSliceReplaceAt([]string{"foo"}, nil, []string{"baz"}, -1) |
| 31 | assert.Assert(t, !ok) |
| 32 | assert.DeepEqual(t, []string{"foo"}, out) |
| 33 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…