Jeffrey's version
This commit is contained in:
parent
9f845ec64b
commit
337c6d41d4
|
@ -1,3 +1,7 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- mode: python -*-
|
||||||
|
# $Id$
|
||||||
|
|
||||||
# Re test suite and benchmark suite v1.5a2
|
# Re test suite and benchmark suite v1.5a2
|
||||||
|
|
||||||
# The 3 possible outcomes for each pattern
|
# The 3 possible outcomes for each pattern
|
||||||
|
@ -16,7 +20,7 @@ benchmarks = [
|
||||||
('.*Python', 'Python'), # Bad text literal
|
('.*Python', 'Python'), # Bad text literal
|
||||||
('.*Python.*', 'Python'), # Worse text literal
|
('.*Python.*', 'Python'), # Worse text literal
|
||||||
('.*(Python)', 'Python'), # Bad text literal with grouping
|
('.*(Python)', 'Python'), # Bad text literal with grouping
|
||||||
|
|
||||||
('(Python|Perl|Tcl', 'Perl'), # Alternation
|
('(Python|Perl|Tcl', 'Perl'), # Alternation
|
||||||
('(Python|Perl|Tcl)', 'Perl'), # Grouped alternation
|
('(Python|Perl|Tcl)', 'Perl'), # Grouped alternation
|
||||||
('(Python)\\1', 'PythonPython'), # Backreference
|
('(Python)\\1', 'PythonPython'), # Backreference
|
||||||
|
@ -34,247 +38,173 @@ benchmarks = [
|
||||||
# 3: a string that will be eval()'ed to produce a test string.
|
# 3: a string that will be eval()'ed to produce a test string.
|
||||||
# This is an arbitrary Python expression; the available
|
# This is an arbitrary Python expression; the available
|
||||||
# variables are "found" (the whole match), and "g1", "g2", ...
|
# variables are "found" (the whole match), and "g1", "g2", ...
|
||||||
# up to "g99" contain the contents of each group, or the
|
# up to "g10" contain the contents of each group, or the
|
||||||
# string 'None' if the group wasn't given a value, or the
|
# string 'None' if the group wasn't given a value.
|
||||||
# string 'Error' if the group index was out of range;
|
|
||||||
# also "groups", the return value of m.group() (a tuple).
|
|
||||||
# 4: The expected result of evaluating the expression.
|
# 4: The expected result of evaluating the expression.
|
||||||
# If the two don't match, an error is reported.
|
# If the two don't match, an error is reported.
|
||||||
#
|
#
|
||||||
# If the regex isn't expected to work, the latter two elements can be omitted.
|
# If the regex isn't expected to work, the latter two elements can be omitted.
|
||||||
|
|
||||||
tests = [
|
tests = [
|
||||||
('abc', 'abc', SUCCEED,
|
('abc', 'abc', SUCCEED, 'found', 'abc'),
|
||||||
'found', 'abc'),
|
('abc', 'xbc', FAIL),
|
||||||
('abc', 'xbc', FAIL),
|
('abc', 'axc', FAIL),
|
||||||
('abc', 'axc', FAIL),
|
('abc', 'abx', FAIL),
|
||||||
('abc', 'abx', FAIL),
|
('abc', 'xabcy', SUCCEED, 'found', 'abc'),
|
||||||
('abc', 'xabcy', SUCCEED,
|
('abc', 'ababc', SUCCEED, 'found', 'abc'),
|
||||||
'found', 'abc'),
|
('ab*c', 'abc', SUCCEED, 'found', 'abc'),
|
||||||
('abc', 'ababc', SUCCEED,
|
('ab*bc', 'abc', SUCCEED, 'found', 'abc'),
|
||||||
'found', 'abc'),
|
('ab*bc', 'abbc', SUCCEED, 'found', 'abbc'),
|
||||||
('ab*c', 'abc', SUCCEED,
|
('ab*bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'),
|
||||||
'found', 'abc'),
|
('ab+bc', 'abbc', SUCCEED, 'found', 'abbc'),
|
||||||
('ab*bc', 'abc', SUCCEED,
|
('ab+bc', 'abc', FAIL),
|
||||||
'found', 'abc'),
|
('ab+bc', 'abq', FAIL),
|
||||||
('ab*bc', 'abbc', SUCCEED,
|
('ab+bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'),
|
||||||
'found', 'abbc'),
|
('ab?bc', 'abbc', SUCCEED, 'found', 'abbc'),
|
||||||
('ab*bc', 'abbbbc', SUCCEED,
|
('ab?bc', 'abc', SUCCEED, 'found', 'abc'),
|
||||||
'found', 'abbbbc'),
|
('ab?bc', 'abbbbc', FAIL),
|
||||||
('ab+bc', 'abbc', SUCCEED,
|
('ab?c', 'abc', SUCCEED, 'found', 'abc'),
|
||||||
'found', 'abbc'),
|
('^abc$', 'abc', SUCCEED, 'found', 'abc'),
|
||||||
('ab+bc', 'abc', FAIL),
|
('^abc$', 'abcc', FAIL),
|
||||||
('ab+bc', 'abq', FAIL),
|
('^abc', 'abcc', SUCCEED, 'found', 'abc'),
|
||||||
('ab+bc', 'abbbbc', SUCCEED,
|
('^abc$', 'aabc', FAIL),
|
||||||
'found', 'abbbbc'),
|
('abc$', 'aabc', SUCCEED, 'found', 'abc'),
|
||||||
('ab?bc', 'abbc', SUCCEED,
|
('^', 'abc', SUCCEED, 'found+"-"', '-'),
|
||||||
'found', 'abbc'),
|
('$', 'abc', SUCCEED, 'found+"-"', '-'),
|
||||||
('ab?bc', 'abc', SUCCEED,
|
('a.c', 'abc', SUCCEED, 'found', 'abc'),
|
||||||
'found', 'abc'),
|
('a.c', 'axc', SUCCEED, 'found', 'axc'),
|
||||||
('ab?bc', 'abbbbc', FAIL),
|
('a.*c', 'axyzc', SUCCEED, 'found', 'axyzc'),
|
||||||
('ab?c', 'abc', SUCCEED,
|
('a.*c', 'axyzd', FAIL),
|
||||||
'found', 'abc'),
|
('a[bc]d', 'abc', FAIL),
|
||||||
('^abc$', 'abc', SUCCEED,
|
('a[bc]d', 'abd', SUCCEED, 'found', 'abd'),
|
||||||
'found', 'abc'),
|
('a[b-d]e', 'abd', FAIL),
|
||||||
('^abc$', 'abcc', FAIL),
|
('a[b-d]e', 'ace', SUCCEED, 'found', 'ace'),
|
||||||
('^abc', 'abcc', SUCCEED,
|
('a[b-d]', 'aac', SUCCEED, 'found', 'ac'),
|
||||||
'found', 'abc'),
|
|
||||||
('^abc$', 'aabc', FAIL),
|
# In 're', the way to put a '-' in a set is to escape it: '[\-]'
|
||||||
('abc$', 'aabc', SUCCEED,
|
# ('a[-b]', 'a-', SUCCEED, 'found', 'a-'),
|
||||||
'found', 'abc'),
|
|
||||||
('^', 'abc', SUCCEED,
|
('a[-b]', 'a-', SYNTAX_ERROR),
|
||||||
'found+"-"', '-'),
|
('a[\\-b]', 'a-', SUCCEED, 'found', 'a-'),
|
||||||
('$', 'abc', SUCCEED,
|
('a[b-]', 'a-', SYNTAX_ERROR),
|
||||||
'found+"-"', '-'),
|
('a[]b', '-', SYNTAX_ERROR),
|
||||||
('a.c', 'abc', SUCCEED,
|
('a[', '-', SYNTAX_ERROR),
|
||||||
'found', 'abc'),
|
('a\\', '-', SYNTAX_ERROR),
|
||||||
('a.c', 'axc', SUCCEED,
|
('abc)', '-', SYNTAX_ERROR),
|
||||||
'found', 'axc'),
|
('(abc', '-', SYNTAX_ERROR),
|
||||||
('a.*c', 'axyzc', SUCCEED,
|
('a]', 'a]', SUCCEED, 'found', 'a]'),
|
||||||
'found', 'axyzc'),
|
|
||||||
('a.*c', 'axyzd', FAIL),
|
# In 're', the way to put a ']' in a set is to escape it: '[\]]'
|
||||||
('a[bc]d', 'abc', FAIL),
|
# ('a[]]b', 'a]b', SUCCEED, 'found', 'a]b'),
|
||||||
('a[bc]d', 'abd', SUCCEED,
|
|
||||||
'found', 'abd'),
|
('a[\]]b', 'a]b', SUCCEED, 'found', 'a]b'),
|
||||||
('a[b-d]e', 'abd', FAIL),
|
('a[^bc]d', 'aed', SUCCEED, 'found', 'aed'),
|
||||||
('a[b-d]e', 'ace', SUCCEED,
|
('a[^bc]d', 'abd', FAIL),
|
||||||
'found', 'ace'),
|
('a[^\\-b]c', 'adc', SUCCEED, 'found', 'adc'),
|
||||||
('a[b-d]', 'aac', SUCCEED,
|
('a[^\\-b]c', 'a-c', FAIL),
|
||||||
'found', 'ac'),
|
('a[^\\]b]c', 'a]c', FAIL),
|
||||||
('a[-b]', 'a-', SUCCEED,
|
('a[^\\]b]c', 'adc', SUCCEED, 'found', 'adc'),
|
||||||
'found', 'a-'),
|
('\\ba\\b', 'a-', SUCCEED, '"-"', '-'),
|
||||||
('a[b-]', 'a-', SYNTAX_ERROR),
|
('\\ba\\b', '-a', SUCCEED, '"-"', '-'),
|
||||||
('a[]b', '-', SYNTAX_ERROR),
|
('\\ba\\b', '-a-', SUCCEED, '"-"', '-'),
|
||||||
('a[', '-', SYNTAX_ERROR),
|
('\\by\\b', 'xy', FAIL),
|
||||||
('a\\', '-', SYNTAX_ERROR),
|
('\\by\\b', 'yz', FAIL),
|
||||||
('abc)', '-', SYNTAX_ERROR),
|
('\\by\\b', 'xyz', FAIL),
|
||||||
('(abc', '-', SYNTAX_ERROR),
|
('ab|cd', 'abc', SUCCEED, 'found', 'ab'),
|
||||||
('a]', 'a]', SUCCEED,
|
('ab|cd', 'abcd', SUCCEED, 'found', 'ab'),
|
||||||
'found', 'a]'),
|
('()ef', 'def', SUCCEED, 'found+"-"+g1', 'ef-'),
|
||||||
('a[]]b', 'a]b', SUCCEED,
|
('$b', 'b', FAIL),
|
||||||
'found', 'a]b'),
|
|
||||||
('a[^bc]d', 'aed', SUCCEED,
|
# This is an error in 1.5
|
||||||
'found', 'aed'),
|
# ('a(b', 'a(b', SUCCEED, 'found+"-"+g1', 'a(b-None'),
|
||||||
('a[^bc]d', 'abd', FAIL),
|
|
||||||
('a[^-b]c', 'adc', SUCCEED,
|
('a\\(*b', 'ab', SUCCEED, 'found', 'ab'),
|
||||||
'found', 'adc'),
|
('a\\(*b', 'a((b', SUCCEED, 'found', 'a((b'),
|
||||||
('a[^-b]c', 'a-c', FAIL),
|
('a\\\\b', 'a\\b', SUCCEED, 'found', 'a\\b'),
|
||||||
('a[^]b]c', 'a]c', FAIL),
|
('((a))', 'abc', SUCCEED, 'found+"-"+g1+"-"+g2', 'a-a-a'),
|
||||||
('a[^]b]c', 'adc', SUCCEED,
|
('(a)b(c)', 'abc', SUCCEED, 'found+"-"+g1+"-"+g2', 'abc-a-c'),
|
||||||
'found', 'adc'),
|
('a+b+c', 'aabbabc', SUCCEED, 'found', 'abc'),
|
||||||
('\\ba\\b', 'a-', SUCCEED,
|
('(a+|b)*', 'ab', SUCCEED, 'found+"-"+g1', 'ab-b'),
|
||||||
'"-"', '-'),
|
('(a+|b)+', 'ab', SUCCEED, 'found+"-"+g1', 'ab-b'),
|
||||||
('\\ba\\b', '-a', SUCCEED,
|
('(a+|b)?', 'ab', SUCCEED, 'found+"-"+g1', 'a-a'),
|
||||||
'"-"', '-'),
|
(')(', '-', SYNTAX_ERROR),
|
||||||
('\\ba\\b', '-a-', SUCCEED,
|
('[^ab]*', 'cde', SUCCEED, 'found', 'cde'),
|
||||||
'"-"', '-'),
|
('abc', '', FAIL),
|
||||||
('\\by\\b', 'xy', FAIL),
|
('a*', '', SUCCEED, 'found', ''),
|
||||||
('\\by\\b', 'yz', FAIL),
|
('a|b|c|d|e', 'e', SUCCEED, 'found', 'e'),
|
||||||
('\\by\\b', 'xyz', FAIL),
|
('(a|b|c|d|e)f', 'ef', SUCCEED, 'found+"-"+g1', 'ef-e'),
|
||||||
('ab|cd', 'abc', SUCCEED,
|
('abcd*efg', 'abcdefg', SUCCEED, 'found', 'abcdefg'),
|
||||||
'found', 'ab'),
|
('ab*', 'xabyabbbz', SUCCEED, 'found', 'ab'),
|
||||||
('ab|cd', 'abcd', SUCCEED,
|
('ab*', 'xayabbbz', SUCCEED, 'found', 'a'),
|
||||||
'found', 'ab'),
|
('(ab|cd)e', 'abcde', SUCCEED, 'found+"-"+g1', 'cde-cd'),
|
||||||
('()ef', 'def', SUCCEED,
|
('[abhgefdc]ij', 'hij', SUCCEED, 'found', 'hij'),
|
||||||
'found+"-"+g1', 'ef-'),
|
('^(ab|cd)e', 'abcde', FAIL,
|
||||||
('$b', 'b', FAIL),
|
'xg1y', 'xy'),
|
||||||
('a\\(b', 'a(b', SUCCEED,
|
('(abc|)ef', 'abcdef', SUCCEED, 'found+"-"+g1', 'ef-'),
|
||||||
'found+"-"+g1', 'a(b-Error'),
|
('(a|b)c*d', 'abcd', SUCCEED, 'found+"-"+g1', 'bcd-b'),
|
||||||
('a\\(*b', 'ab', SUCCEED,
|
('(ab|ab*)bc', 'abc', SUCCEED, 'found+"-"+g1', 'abc-a'),
|
||||||
'found', 'ab'),
|
('a([bc]*)c*', 'abc', SUCCEED, 'found+"-"+g1', 'abc-bc'),
|
||||||
('a\\(*b', 'a((b', SUCCEED,
|
('a([bc]*)(c*d)', 'abcd', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcd-bc-d'),
|
||||||
'found', 'a((b'),
|
('a([bc]+)(c*d)', 'abcd', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcd-bc-d'),
|
||||||
('a\\\\b', 'a\\b', SUCCEED,
|
('a([bc]*)(c+d)', 'abcd', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcd-b-cd'),
|
||||||
'found', 'a\\b'),
|
('a[bcd]*dcdcde', 'adcdcde', SUCCEED, 'found', 'adcdcde'),
|
||||||
('((a))', 'abc', SUCCEED,
|
('a[bcd]+dcdcde', 'adcdcde', FAIL),
|
||||||
'found+"-"+g1+"-"+g2', 'a-a-a'),
|
('(ab|a)b*c', 'abc', SUCCEED, 'found+"-"+g1', 'abc-ab'),
|
||||||
('(a)b(c)', 'abc', SUCCEED,
|
('((a)(b)c)(d)', 'abcd', SUCCEED, 'g1+"-"+g2+"-"+g3+"-"+g4', 'abc-a-b-d'),
|
||||||
'found+"-"+g1+"-"+g2', 'abc-a-c'),
|
('[a-zA-Z_][a-zA-Z0-9_]*', 'alpha', SUCCEED, 'found', 'alpha'),
|
||||||
('a+b+c', 'aabbabc', SUCCEED,
|
('^a(bc+|b[eh])g|.h$', 'abh', SUCCEED, 'found+"-"+g1', 'bh-None'),
|
||||||
'found', 'abc'),
|
('(bc+d$|ef*g.|h?i(j|k))', 'effgz', SUCCEED, 'found+"-"+g1+"-"+g2', 'effgz-effgz-None'),
|
||||||
('(a+|b)*', 'ab', SUCCEED,
|
('(bc+d$|ef*g.|h?i(j|k))', 'ij', SUCCEED, 'found+"-"+g1+"-"+g2', 'ij-ij-j'),
|
||||||
'found+"-"+g1', 'ab-b'),
|
('(bc+d$|ef*g.|h?i(j|k))', 'effg', FAIL),
|
||||||
('(a+|b)+', 'ab', SUCCEED,
|
('(bc+d$|ef*g.|h?i(j|k))', 'bcdd', FAIL),
|
||||||
'found+"-"+g1', 'ab-b'),
|
('(bc+d$|ef*g.|h?i(j|k))', 'reffgz', SUCCEED, 'found+"-"+g1+"-"+g2', 'effgz-effgz-None'),
|
||||||
('(a+|b)?', 'ab', SUCCEED,
|
('(((((((((a)))))))))', 'a', SUCCEED, 'found', 'a'),
|
||||||
'found+"-"+g1', 'a-a'),
|
('multiple words of text', 'uh-uh', FAIL),
|
||||||
(')(', '-', SYNTAX_ERROR),
|
('multiple words', 'multiple words, yeah', SUCCEED, 'found', 'multiple words'),
|
||||||
('[^ab]*', 'cde', SUCCEED,
|
('(.*)c(.*)', 'abcde', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcde-ab-de'),
|
||||||
'found', 'cde'),
|
('\\((.*), (.*)\\)', '(a, b)', SUCCEED, 'g2+"-"+g1', 'b-a'),
|
||||||
('abc', '', FAIL),
|
('[k]', 'ab', FAIL),
|
||||||
('a*', '', SUCCEED,
|
('a[-]?c', 'ac', SUCCEED, 'found', 'ac'),
|
||||||
'found', ''),
|
('(abc)\\1', 'abcabc', SUCCEED, 'g1', 'abc'),
|
||||||
('a|b|c|d|e', 'e', SUCCEED,
|
('([a-c]*)\\1', 'abcabc', SUCCEED, 'g1', 'abc'),
|
||||||
'found', 'e'),
|
('^(.+)?B', 'AB', SUCCEED, 'g1', 'A'),
|
||||||
('(a|b|c|d|e)f', 'ef', SUCCEED,
|
('(a+).\\1$', 'aaaaa', SUCCEED, 'found+"-"+g1', 'aaaaa-aa'),
|
||||||
'found+"-"+g1', 'ef-e'),
|
('^(a+).\\1$', 'aaaa', FAIL),
|
||||||
('abcd*efg', 'abcdefg', SUCCEED,
|
('(abc)\\1', 'abcabc', SUCCEED, 'found+"-"+g1', 'abcabc-abc'),
|
||||||
'found', 'abcdefg'),
|
('([a-c]+)\\1', 'abcabc', SUCCEED, 'found+"-"+g1', 'abcabc-abc'),
|
||||||
('ab*', 'xabyabbbz', SUCCEED,
|
('(a)\\1', 'aa', SUCCEED, 'found+"-"+g1', 'aa-a'),
|
||||||
'found', 'ab'),
|
('(a+)\\1', 'aa', SUCCEED, 'found+"-"+g1', 'aa-a'),
|
||||||
('ab*', 'xayabbbz', SUCCEED,
|
('(a+)+\\1', 'aa', SUCCEED, 'found+"-"+g1', 'aa-a'),
|
||||||
'found', 'a'),
|
('(a).+\\1', 'aba', SUCCEED, 'found+"-"+g1', 'aba-a'),
|
||||||
('(ab|cd)e', 'abcde', SUCCEED,
|
('(a)ba*\\1', 'aba', SUCCEED, 'found+"-"+g1', 'aba-a'),
|
||||||
'found+"-"+g1', 'cde-cd'),
|
('(aa|a)a\\1$', 'aaa', SUCCEED, 'found+"-"+g1', 'aaa-a'),
|
||||||
('[abhgefdc]ij', 'hij', SUCCEED,
|
('(a|aa)a\\1$', 'aaa', SUCCEED, 'found+"-"+g1', 'aaa-a'),
|
||||||
'found', 'hij'),
|
('(a+)a\\1$', 'aaa', SUCCEED, 'found+"-"+g1', 'aaa-a'),
|
||||||
('^(ab|cd)e', 'abcde', FAIL,
|
('([abc]*)\\1', 'abcabc', SUCCEED, 'found+"-"+g1', 'abcabc-abc'),
|
||||||
'xg1y', 'xy'),
|
('(a)(b)c|ab', 'ab', SUCCEED, 'found+"-"+g1+"-"+g2', 'ab-None-None'),
|
||||||
('(abc|)ef', 'abcdef', SUCCEED,
|
('(a)+x', 'aaax', SUCCEED, 'found+"-"+g1', 'aaax-a'),
|
||||||
'found+"-"+g1', 'ef-'),
|
('([ac])+x', 'aacx', SUCCEED, 'found+"-"+g1', 'aacx-c'),
|
||||||
('(a|b)c*d', 'abcd', SUCCEED,
|
('([^/]*/)*sub1/', 'd:msgs/tdir/sub1/trial/away.cpp', SUCCEED, 'found+"-"+g1', 'd:msgs/tdir/sub1/-tdir/'),
|
||||||
'found+"-"+g1', 'bcd-b'),
|
('([^.]*)\\.([^:]*):[T ]+(.*)', 'track1.title:TBlah blah blah', SUCCEED, 'found+"-"+g1+"-"+g2+"-"+g3', 'track1.title:TBlah blah blah-track1-title-Blah blah blah'),
|
||||||
('(ab|ab*)bc', 'abc', SUCCEED,
|
('([^N]*N)+', 'abNNxyzN', SUCCEED, 'found+"-"+g1', 'abNNxyzN-xyzN'),
|
||||||
'found+"-"+g1', 'abc-a'),
|
('([^N]*N)+', 'abNNxyz', SUCCEED, 'found+"-"+g1', 'abNN-N'),
|
||||||
('a([bc]*)c*', 'abc', SUCCEED,
|
('([abc]*)x', 'abcx', SUCCEED, 'found+"-"+g1', 'abcx-abc'),
|
||||||
'found+"-"+g1', 'abc-bc'),
|
('([abc]*)x', 'abc', FAIL),
|
||||||
('a([bc]*)(c*d)', 'abcd', SUCCEED,
|
('([xyz]*)x', 'abcx', SUCCEED, 'found+"-"+g1', 'x-'),
|
||||||
'found+"-"+g1+"-"+g2', 'abcd-bc-d'),
|
('(a)+b|aac', 'aac', SUCCEED, 'found+"-"+g1', 'aac-None'),
|
||||||
('a([bc]+)(c*d)', 'abcd', SUCCEED,
|
|
||||||
'found+"-"+g1+"-"+g2', 'abcd-bc-d'),
|
# Test symbolic groups
|
||||||
('a([bc]*)(c+d)', 'abcd', SUCCEED,
|
|
||||||
'found+"-"+g1+"-"+g2', 'abcd-b-cd'),
|
('(?P<i d>aaa)a', 'aaaa', SYNTAX_ERROR),
|
||||||
('a[bcd]*dcdcde', 'adcdcde', SUCCEED,
|
('(?P<id>aaa)a', 'aaaa', SUCCEED, 'found+"-"+id', 'aaaa-aaa'),
|
||||||
'found', 'adcdcde'),
|
('(?P<id>aa)(?P=id)', 'aaaa', SUCCEED, 'found+"-"+id', 'aaaa-aa'),
|
||||||
('a[bcd]+dcdcde', 'adcdcde', FAIL),
|
('(?P<id>aa)(?P=xd)', 'aaaa', SYNTAX_ERROR),
|
||||||
('(ab|a)b*c', 'abc', SUCCEED,
|
|
||||||
'found+"-"+g1', 'abc-ab'),
|
# Test octal escapes/memory references
|
||||||
('((a)(b)c)(d)', 'abcd', SUCCEED,
|
|
||||||
'g1+"-"+g2+"-"+g3+"-"+g4', 'abc-a-b-d'),
|
('\\1', 'a', SYNTAX_ERROR),
|
||||||
('[a-zA-Z_][a-zA-Z0-9_]*', 'alpha', SUCCEED,
|
('\\09', chr(0) + '9', SUCCEED, 'found', chr(0) + '9'),
|
||||||
'found', 'alpha'),
|
('\\141', 'a', SUCCEED, 'found', 'a'),
|
||||||
('^a(bc+|b[eh])g|.h$', 'abh', SUCCEED,
|
('(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\\119', 'abcdefghijklk9', SUCCEED, 'found+"-"+g11', 'abcdefghijklk9-k')
|
||||||
'found+"-"+g1', 'bh-None'),
|
|
||||||
('(bc+d$|ef*g.|h?i(j|k))', 'effgz', SUCCEED,
|
]
|
||||||
'found+"-"+g1+"-"+g2', 'effgz-effgz-None'),
|
|
||||||
('(bc+d$|ef*g.|h?i(j|k))', 'ij', SUCCEED,
|
|
||||||
'found+"-"+g1+"-"+g2', 'ij-ij-j'),
|
|
||||||
('(bc+d$|ef*g.|h?i(j|k))', 'effg', FAIL),
|
|
||||||
('(bc+d$|ef*g.|h?i(j|k))', 'bcdd', FAIL),
|
|
||||||
('(bc+d$|ef*g.|h?i(j|k))', 'reffgz', SUCCEED,
|
|
||||||
'found+"-"+g1+"-"+g2', 'effgz-effgz-None'),
|
|
||||||
('(((((((((a)))))))))', 'a', SUCCEED,
|
|
||||||
'found', 'a'),
|
|
||||||
('multiple words of text', 'uh-uh', FAIL),
|
|
||||||
('multiple words', 'multiple words, yeah', SUCCEED,
|
|
||||||
'found', 'multiple words'),
|
|
||||||
('(.*)c(.*)', 'abcde', SUCCEED,
|
|
||||||
'found+"-"+g1+"-"+g2', 'abcde-ab-de'),
|
|
||||||
('\\((.*), (.*)\\)', '(a, b)', SUCCEED,
|
|
||||||
'g2+"-"+g1', 'b-a'),
|
|
||||||
('[k]', 'ab', FAIL),
|
|
||||||
('a[-]?c', 'ac', SUCCEED,
|
|
||||||
'found', 'ac'),
|
|
||||||
('(abc)\\1', 'abcabc', SUCCEED,
|
|
||||||
'g1', 'abc'),
|
|
||||||
('([a-c]*)\\1', 'abcabc', SUCCEED,
|
|
||||||
'g1', 'abc'),
|
|
||||||
('^(.+)?B', 'AB', SUCCEED,
|
|
||||||
'g1', 'A'),
|
|
||||||
('(a+).\\1$', 'aaaaa', SUCCEED,
|
|
||||||
'found+"-"+g1', 'aaaaa-aa'),
|
|
||||||
('^(a+).\\1$', 'aaaa', FAIL),
|
|
||||||
('(abc)\\1', 'abcabc', SUCCEED,
|
|
||||||
'found+"-"+g1', 'abcabc-abc'),
|
|
||||||
('([a-c]+)\\1', 'abcabc', SUCCEED,
|
|
||||||
'found+"-"+g1', 'abcabc-abc'),
|
|
||||||
('(a)\\1', 'aa', SUCCEED,
|
|
||||||
'found+"-"+g1', 'aa-a'),
|
|
||||||
('(a+)\\1', 'aa', SUCCEED,
|
|
||||||
'found+"-"+g1', 'aa-a'),
|
|
||||||
('(a+)+\\1', 'aa', SUCCEED,
|
|
||||||
'found+"-"+g1', 'aa-a'),
|
|
||||||
('(a).+\\1', 'aba', SUCCEED,
|
|
||||||
'found+"-"+g1', 'aba-a'),
|
|
||||||
('(a)ba*\\1', 'aba', SUCCEED,
|
|
||||||
'found+"-"+g1', 'aba-a'),
|
|
||||||
('(aa|a)a\\1$', 'aaa', SUCCEED,
|
|
||||||
'found+"-"+g1', 'aaa-a'),
|
|
||||||
('(a|aa)a\\1$', 'aaa', SUCCEED,
|
|
||||||
'found+"-"+g1', 'aaa-a'),
|
|
||||||
('(a+)a\\1$', 'aaa', SUCCEED,
|
|
||||||
'found+"-"+g1', 'aaa-a'),
|
|
||||||
('([abc]*)\\1', 'abcabc', SUCCEED,
|
|
||||||
'found+"-"+g1', 'abcabc-abc'),
|
|
||||||
('(a)(b)c|ab', 'ab', SUCCEED,
|
|
||||||
'found+"-"+g1+"-"+g2', 'ab-None-None'),
|
|
||||||
('(a)+x', 'aaax', SUCCEED,
|
|
||||||
'found+"-"+g1', 'aaax-a'),
|
|
||||||
('([ac])+x', 'aacx', SUCCEED,
|
|
||||||
'found+"-"+g1', 'aacx-c'),
|
|
||||||
('([^/]*/)*sub1/', 'd:msgs/tdir/sub1/trial/away.cpp', SUCCEED,
|
|
||||||
'found+"-"+g1', 'd:msgs/tdir/sub1/-tdir/'),
|
|
||||||
('([^.]*)\\.([^:]*):[T ]+(.*)', 'track1.title:TBlah blah blah', SUCCEED,
|
|
||||||
'found+"-"+g1+"-"+g2+"-"+g3', 'track1.title:TBlah blah blah-track1-title-Blah blah blah'),
|
|
||||||
('([^N]*N)+', 'abNNxyzN', SUCCEED,
|
|
||||||
'found+"-"+g1', 'abNNxyzN-xyzN'),
|
|
||||||
('([^N]*N)+', 'abNNxyz', SUCCEED,
|
|
||||||
'found+"-"+g1', 'abNN-N'),
|
|
||||||
('([abc]*)x', 'abcx', SUCCEED,
|
|
||||||
'found+"-"+g1', 'abcx-abc'),
|
|
||||||
('([abc]*)x', 'abc', FAIL),
|
|
||||||
('([xyz]*)x', 'abcx', SUCCEED,
|
|
||||||
'found+"-"+g1', 'x-'),
|
|
||||||
('(a)+b|aac', 'aac', SUCCEED,
|
|
||||||
'found+"-"+g1', 'aac-None'),
|
|
||||||
]
|
|
||||||
|
|
Loading…
Reference in New Issue