(t *testing.T)
| 119 | } |
| 120 | |
| 121 | func TestStringFixedDistanceCharFilter(t *testing.T) { |
| 122 | filter := stringFixedDistanceCharFilter('a', 2, 3) |
| 123 | if filter == nil { |
| 124 | t.Fatal("expected filter") |
| 125 | } |
| 126 | |
| 127 | candidateByteIndex, ok := filter("é12a", 0) |
| 128 | if !ok { |
| 129 | t.Fatal("expected candidate") |
| 130 | } |
| 131 | if got, want := candidateByteIndex, 2; got != want { |
| 132 | t.Fatalf("candidateByteIndex = %d, want %d", got, want) |
| 133 | } |
| 134 | |
| 135 | if _, ok := filter("xyz", 0); ok { |
| 136 | t.Fatal("unexpected candidate for missing char") |
| 137 | } |
| 138 | |
| 139 | if _, ok := filter("xyz", 0); ok { |
| 140 | t.Fatal("unexpected candidate for missing char") |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | func TestStringFixedDistanceCharFilterCandidateBeforeStart(t *testing.T) { |
| 145 | filter := stringFixedDistanceCharFilter('a', 2, 1) |
nothing calls this directly
no test coverage detected