1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

regex: bugfix for #18363, [^\s]+ act different from \S+ (#18371)

This commit is contained in:
penguindark
2023-06-09 13:34:06 +02:00
committed by GitHub
parent 5300441c09
commit 1de6523da5
2 changed files with 79 additions and 1 deletions

View File

@@ -105,7 +105,6 @@ match_test_suite = [
TestItem{"this cpapaz adce aabe third",r"(c(pa)+z)(\s[\a]+){2}$",-1,0},
TestItem{"1234this cpapaz adce aabe ter",r"(c(pa)+z)(\s[\a]+){2}$",-1,0},
TestItem{"cpapaz ole. pipipo,",r"^.*c.+ol?e.*p([ip])+o$",-1,0},
TestItem{"/home/us_er/pippo/info-01.jpeg", r"(/?[-\w_]+)*\.txt$",-1,26}
// check unicode
TestItem{"this is a test",r".*a [-Ⅵ ]+",0,34},
@@ -174,6 +173,14 @@ match_test_suite = [
TestItem{"refs/remotes/origin/master", r"refs/remotes/origin/(.*)",0,26},
TestItem{"refs/remotes/origin/mastep", r"refs/remotes/origin/(\w*)",0,26},
TestItem{"refs/remotes/origin/master", r"refs/remotes/origin/(\w*)",0,26},
// test \S+ vs [^\s]+
TestItem{"ab.c", r"\S+\.",0,3},
TestItem{"ab.c", r"[^\s]+\.",0,3},
TestItem{"ab.c", r"\S*\.",0,3},
TestItem{"ab.c", r"[^\s]*\.",0,3},
TestItem{"ab c", r"[\S]+\s",0,3},
TestItem{"ab c", r"[^\s]+\s",0,3},
]
)