diff options
Diffstat (limited to 'tests/regex/testscript')
-rw-r--r-- | tests/regex/testscript | 67 |
1 files changed, 40 insertions, 27 deletions
diff --git a/tests/regex/testscript b/tests/regex/testscript index fbee1d6..93ad4b6 100644 --- a/tests/regex/testscript +++ b/tests/regex/testscript @@ -4,38 +4,38 @@ : replace-search : { - $* abcbd b x >axcxd : all - $* -ffo abcbd b x >axcbd : first-only - $* -fnc abcbd b x >xx : no-copy + $* abcbd /b/x/ >axcxd : all + $* -ffo abcbd /b/x/ >axcbd : first-only + $* -fnc abcbd /b/x/ >xx : no-copy : ecma-escape : { - $* xay a '$b' >'x$by' : none - $* xay a '$' >'x$y' : none-term - $* xay a '$$' >'x$y' : self - $* xay a 'b$&c' >'xbacy' : match - $* xay a 'b$`c' >'xbxcy' : match-precede - $* xay a "b\\\$'c" >'xbycy' : match-follow + $* xay '/a/$b/' >'x$by' : none + $* xay '/a/$/' >'x$y' : none-term + $* xay '/a/$$/' >'x$y' : self + $* xay '/a/b$&c/' >'xbacy' : match + $* xay '/a/b$`c/' >'xbxcy' : match-precede + $* xay "/a/b\\\$'c/" >'xbycy' : match-follow : capture : { - $* abcdefghij '(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)' '$1$10' >aj : matched - $* a '(a)|(b)' '$1$2$3' >a : unmatched + $* abcdefghij '/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)/$1$10/' >aj : matched + $* a '/(a)|(b)/$1$2$3/' >a : unmatched } } : perl-escape : { - $* xay a '\b' >'xby' : none - $* xay a '\' >'xy' : none-term - $* xay a '\\' >'x\y' : self + $* xay '/a/\b/' >'xby' : none + $* xay '/a/\/' >'xy' : none-term + $* xay '/a/\\/' >'x\y' : self : newline : - $* xay a '\n' >>EOO + $* xay '/a/\n/' >>EOO x y EOO @@ -43,25 +43,25 @@ : capture : { - $* abcdefghij '(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)' '\1\10' >aa0 : matched - $* a '(a)|(b)' '\1\2\3' >a : unmatched + $* abcdefghij '/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)/\1\10/' >aa0 : matched + $* a '/(a)|(b)/\1\2\3/' >a : unmatched } : upper : { - $* xay a '\U' >xy : none - $* xay a '\Uvz' >xVZy : repl - $* xay a '\Uv\Ez' >xVzy : end - $* aa a 'v\Uz' >vZvZ : locality - $* xay '(a)' '\U\1' >xAy : capt - $* x-y '(a?)-' '\U\1z' >xZy : capt-empty - $* xay a '\uvz' >xVzy : once + $* xay '/a/\U/' >xy : none + $* xay '/a/\Uvz/' >xVZy : repl + $* xay '/a/\Uv\Ez/' >xVzy : end + $* aa '/a/v\Uz/' >vZvZ : locality + $* xay '/(a)/\U\1/' >xAy : capt + $* x-y '/(a?)-/\U\1z/' >xZy : capt-empty + $* xay '/a/\uvz/' >xVzy : once } : lower : - $* xay a '\lVZ' >xvZy + $* xay '/a/\lVZ/' >xvZy } } @@ -70,6 +70,19 @@ { test.options += -m - $* abc 'a(b)c' 'x\1y' >xby : match - $* abcd 'a(b)c' 'x\1yd' == 1 : no-match + $* abc '/a(b)c/x\1y/' >xby : match + $* abcd '/a(b)c/x\1yd/' == 1 : no-match +} + +: invalid-regex-fmt +: +{ + test.arguments += '' # Note: we will fail before the matching. + + $* '' 2> 'no leading delimiter' != 0 : no-leading-delim + $* '/a' 2> 'no delimiter after regex' != 0 : no-mid-delim + $* '//' 2> 'empty regex' != 0 : no-regex + $* '/a[b/c/' 2>~'/invalid regex.*/' != 0 : regex + $* '/a/b' 2> 'no delimiter after replacement' != 0 : no-trailing-delim + $* '/a/b/s' 2> 'junk after trailing delimiter' != 0 : junk } |