| 1 |
# This tests that we can switch the line terminator to the NUL byte. |
| 2 |
[[test]] |
| 3 |
name = "nul" |
| 4 |
regex = '(?m)^[a-z]+$' |
| 5 |
haystack = '\x00abc\x00' |
| 6 |
matches = [[1, 4]] |
| 7 |
unescape = true |
| 8 |
line-terminator = '\x00' |
| 9 |
|
| 10 |
# This tests that '.' will not match the configured line terminator, but will |
| 11 |
# match \n. |
| 12 |
[[test]] |
| 13 |
name = "dot-changes-with-line-terminator" |
| 14 |
regex = '.' |
| 15 |
haystack = '\x00\n' |
| 16 |
matches = [[1, 2]] |
| 17 |
unescape = true |
| 18 |
line-terminator = '\x00' |
| 19 |
|
| 20 |
# This tests that when we switch the line terminator, \n is no longer |
| 21 |
# recognized as the terminator. |
| 22 |
[[test]] |
| 23 |
name = "not-line-feed" |
| 24 |
regex = '(?m)^[a-z]+$' |
| 25 |
haystack = '\nabc\n' |
| 26 |
matches = [] |
| 27 |
unescape = true |
| 28 |
line-terminator = '\x00' |
| 29 |
|
| 30 |
# This tests that we can set the line terminator to a non-ASCII byte and have |
| 31 |
# it behave as expected. |
| 32 |
[[test]] |
| 33 |
name = "non-ascii" |
| 34 |
regex = '(?m)^[a-z]+$' |
| 35 |
haystack = '\xFFabc\xFF' |
| 36 |
matches = [[1, 4]] |
| 37 |
unescape = true |
| 38 |
line-terminator = '\xFF' |
| 39 |
utf8 = false |
| 40 |
|
| 41 |
# This tests a tricky case where the line terminator is set to \r. This ensures |
| 42 |
# that the StartLF look-behind assertion is tracked when computing the start |
| 43 |
# state. |
| 44 |
[[test]] |
| 45 |
name = "carriage" |
| 46 |
regex = '(?m)^[a-z]+' |
| 47 |
haystack = 'ABC\rabc' |
| 48 |
matches = [[4, 7]] |
| 49 |
bounds = [4, 7] |
| 50 |
unescape = true |
| 51 |
line-terminator = '\r' |
| 52 |
|
| 53 |
# This tests that we can set the line terminator to a byte corresponding to a |
| 54 |
# word character, and things work as expected. |
| 55 |
[[test]] |
| 56 |
name = "word-byte" |
| 57 |
regex = '(?m)^[a-z]+$' |
| 58 |
haystack = 'ZabcZ' |
| 59 |
matches = [[1, 4]] |
| 60 |
unescape = true |
| 61 |
line-terminator = 'Z' |
| 62 |
|
| 63 |
# This tests that we can set the line terminator to a byte corresponding to a |
| 64 |
# non-word character, and things work as expected. |
| 65 |
[[test]] |
| 66 |
name = "non-word-byte" |
| 67 |
regex = '(?m)^[a-z]+$' |
| 68 |
haystack = '%abc%' |
| 69 |
matches = [[1, 4]] |
| 70 |
unescape = true |
| 71 |
line-terminator = '%' |
| 72 |
|
| 73 |
# This combines "set line terminator to a word byte" with a word boundary |
| 74 |
# assertion, which should result in no match even though ^/$ matches. |
| 75 |
[[test]] |
| 76 |
name = "word-boundary" |
| 77 |
regex = '(?m)^\b[a-z]+\b$' |
| 78 |
haystack = 'ZabcZ' |
| 79 |
matches = [] |
| 80 |
unescape = true |
| 81 |
line-terminator = 'Z' |
| 82 |
|
| 83 |
# Like 'word-boundary', but does an anchored search at the point where ^ |
| 84 |
# matches, but where \b should not. |
| 85 |
[[test]] |
| 86 |
name = "word-boundary-at" |
| 87 |
regex = '(?m)^\b[a-z]+\b$' |
| 88 |
haystack = 'ZabcZ' |
| 89 |
matches = [] |
| 90 |
bounds = [1, 4] |
| 91 |
anchored = true |
| 92 |
unescape = true |
| 93 |
line-terminator = 'Z' |
| 94 |
|
| 95 |
# Like 'word-boundary-at', but flips the word boundary to a negation. This |
| 96 |
# in particular tests a tricky case in DFA engines, where they must consider |
| 97 |
# explicitly that a starting configuration from a custom line terminator may |
| 98 |
# also required setting the "is from word byte" flag on a state. Otherwise, |
| 99 |
# it's treated as "not from a word byte," which would result in \B not matching |
| 100 |
# here when it should. |
| 101 |
[[test]] |
| 102 |
name = "not-word-boundary-at" |
| 103 |
regex = '(?m)^\B[a-z]+\B$' |
| 104 |
haystack = 'ZabcZ' |
| 105 |
matches = [[1, 4]] |
| 106 |
bounds = [1, 4] |
| 107 |
anchored = true |
| 108 |
unescape = true |
| 109 |
line-terminator = 'Z' |