(t *testing.T)
| 178 | } |
| 179 | |
| 180 | func TestStringLiteralAfterLoopFilter(t *testing.T) { |
| 181 | filter := stringLiteralAfterLoopFilter(&syntax.LiteralAfterLoop{ |
| 182 | Char: '@', |
| 183 | LoopNode: &syntax.RegexNode{ |
| 184 | Set: syntax.DigitClass(), |
| 185 | }, |
| 186 | }, 4) |
| 187 | if filter == nil { |
| 188 | t.Fatal("expected filter") |
| 189 | } |
| 190 | |
| 191 | candidateByteIndex, ok := filter("xx123@", 0) |
| 192 | if !ok { |
| 193 | t.Fatal("expected candidate") |
| 194 | } |
| 195 | if got, want := candidateByteIndex, 0; got != want { |
| 196 | t.Fatalf("candidateByteIndex = %d, want %d", got, want) |
| 197 | } |
| 198 | |
| 199 | if _, ok := filter("xx123", 0); ok { |
| 200 | t.Fatal("unexpected candidate for missing literal") |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | func TestNewStringPrefixFilterFixedDistanceChar(t *testing.T) { |
| 205 | filter := newStringPrefixFilter(&syntax.Code{ |
nothing calls this directly
no test coverage detected