mirror of
https://github.com/vlang/v.git
synced 2025-09-11 16:36:20 -04:00
This commit is contained in:
parent
55e86febf6
commit
772f11494f
@ -2429,7 +2429,8 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) {
|
|||||||
// println("ist_simple_char")
|
// println("ist_simple_char")
|
||||||
state.match_flag = false
|
state.match_flag = false
|
||||||
|
|
||||||
if re.prog[state.pc].ch == ch {
|
if re.prog[state.pc].ch == ch
|
||||||
|
&& (state.i < in_txt_len - 1 || re.prog[state.pc].ch != 0) {
|
||||||
state.match_flag = true
|
state.match_flag = true
|
||||||
l_ist = regex.ist_simple_char
|
l_ist = regex.ist_simple_char
|
||||||
|
|
||||||
|
@ -185,6 +185,14 @@ match_test_suite = [
|
|||||||
// test last charr classes neg class
|
// test last charr classes neg class
|
||||||
TestItem{"/a/", r"^/a/[^/]+$", -1,3},
|
TestItem{"/a/", r"^/a/[^/]+$", -1,3},
|
||||||
TestItem{"/a/b",r"^/a/[^/]+$", 0,4},
|
TestItem{"/a/b",r"^/a/[^/]+$", 0,4},
|
||||||
|
|
||||||
|
// test `\0` as terminator
|
||||||
|
TestItem{"abc", "^abc\0$", -1,3},
|
||||||
|
TestItem{"abc\0", "^abc\0$", 0,4},
|
||||||
|
|
||||||
|
// test has `\0` chars
|
||||||
|
TestItem{"abcxyz", "^abc\0xyz$", -1,3},
|
||||||
|
TestItem{"abc\0xyz", "^abc\0xyz$", 0,7},
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user