(t *testing.T)
| 16 | ) |
| 17 | |
| 18 | func TestRunesIndexOf(t *testing.T) { |
| 19 | type TestCase struct { |
| 20 | Pattern string |
| 21 | Start int |
| 22 | |
| 23 | Expected int |
| 24 | } |
| 25 | |
| 26 | for i, tc := range []TestCase{ |
| 27 | {"abc", 0, 0}, |
| 28 | {"cde", 0, 2}, |
| 29 | {"e", 0, 4}, |
| 30 | {"cdef", 0, -1}, |
| 31 | {"abcdef", 0, -1}, |
| 32 | {"abc", 2, -1}, |
| 33 | {"cde", 2, 2}, |
| 34 | {"e", 2, 4}, |
| 35 | {"cdef", 2, -1}, |
| 36 | {"abcdef", 2, -1}, |
| 37 | {"e", 6, -1}, |
| 38 | } { |
| 39 | actual := runesIndexOf([]rune("abcde"), []rune(tc.Pattern), tc.Start) |
| 40 | assert.Equal(t, tc.Expected, actual, fmt.Sprintf("Test case #%d, %#v", i, tc)) |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | func TestIndexOf(t *testing.T) { |
| 45 | type TestCase struct { |
nothing calls this directly
no test coverage detected