1 USING: kernel tools.test regexp.backend regexp ;
4 : test-regexp ( string -- )
5 default-regexp parse-regexp ;
7 ! [ "(" ] [ unmatched-parentheses? ] must-fail-with
9 [ ] [ "a|b" test-regexp ] unit-test
10 [ ] [ "a.b" test-regexp ] unit-test
11 [ ] [ "a|b|c" test-regexp ] unit-test
12 [ ] [ "abc|b" test-regexp ] unit-test
13 [ ] [ "a|bcd" test-regexp ] unit-test
14 [ ] [ "a|(b)" test-regexp ] unit-test
15 [ ] [ "(a)|b" test-regexp ] unit-test
16 [ ] [ "(a|b)" test-regexp ] unit-test
17 [ ] [ "((a)|(b))" test-regexp ] unit-test
19 [ ] [ "(?:a)" test-regexp ] unit-test
20 [ ] [ "(?i:a)" test-regexp ] unit-test
21 [ ] [ "(?-i:a)" test-regexp ] unit-test
22 [ "(?z:a)" test-regexp ] [ unknown-regexp-option? ] must-fail-with
23 [ "(?-z:a)" test-regexp ] [ unknown-regexp-option? ] must-fail-with
25 [ ] [ "(?=a)" test-regexp ] unit-test
27 [ ] [ "[abc]" test-regexp ] unit-test
28 [ ] [ "[a-c]" test-regexp ] unit-test
29 [ ] [ "[^a-c]" test-regexp ] unit-test
30 [ "[^]" test-regexp ] must-fail
32 [ ] [ "|b" test-regexp ] unit-test
33 [ ] [ "b|" test-regexp ] unit-test
34 [ ] [ "||" test-regexp ] unit-test