(fail-a): Adjust exit status to match new expr behavior, for status 2 versus 3.

(anchor): New test.
(bre1, bre2, bre3, bre4, bre5, bre6, bre7, bre8, bre9, bre10):
(bre11, bre12, bre13, bre14, bre15, bre16, bre17, bre18, bre19, bre20):
(bre21, bre22, bre23, bre24, bre25, bre26, bre27, bre28, bre29, bre30):
(bre31, bre32, bre33, bre34, bre35, bre36, bre37, bre38, bre39, bre40):
(bre41, bre42, bre43, bre44, bre45, bre46, bre47, bre48, bre49, bre50):
(bre51, bre52, bre53, bre54, bre55, bre56, bre57, bre58, bre59, bre60):
(bre61, bre62): New tests.
This commit is contained in:
Paul Eggert 2006-04-12 07:17:02 +00:00
parent 110970f622
commit 661b506c3d

View File

@ -57,12 +57,91 @@ my @Tests =
# This erroneously succeeded and output `3' before 2.0.12.
['fail-a', '3 + -', {ERR => "$prog: non-numeric argument\n"},
{EXIT => 3}],
{EXIT => 2}],
# This erroneously succeeded before 5.3.1.
['bigcmp', '-- -2417851639229258349412352 \< 2417851639229258349412352',
{OUT => '1'}, {EXIT => 0}],
# In 5.94 and earlier, anchors incorrectly matched newlines.
['anchor', "'a\nb' : 'a\$'", {OUT => '0'}, {EXIT => 1}],
# These tests are taken from grep/tests/bre.tests.
['bre1', '"abc" : "a\\(b\\)c"', {OUT => 'b'}],
['bre2', '"a(" : "a("', {OUT => '2'}],
['bre3', '_ : "a\\("',
{ERR => "$prog: Unmatched ( or \\(\n"}, {EXIT => 2}],
['bre4', '_ : "a\\(b"',
{ERR => "$prog: Unmatched ( or \\(\n"}, {EXIT => 2}],
['bre5', '"a(b" : "a(b"', {OUT => '3'}],
['bre6', '"a)" : "a)"', {OUT => '2'}],
['bre7', '_ : "a\\)"',
{ERR => "$prog: Unmatched ) or \\)\n"}, {EXIT => 2}],
['bre8', '_ : "\\)"',
{ERR => "$prog: Unmatched ) or \\)\n"}, {EXIT => 2}],
['bre9', '"ab" : "a\\(\\)b"', {OUT => ''}, {EXIT => 1}],
['bre10', '"a^b" : "a^b"', {OUT => '3'}],
['bre11', '"a\$b" : "a\$b"', {OUT => '3'}],
['bre12', '"" : "\\($\\)\\(^\\)"', {OUT => ''}, {EXIT => 1}],
['bre13', '"b" : "a*\\(^b\$\\)c*"', {OUT => 'b'}],
['bre14', '"X|" : "X\\(|\\)" : "(" "X|" : "X\\(|\\)" ")"', {OUT => '1'}],
['bre15', '"X*" : "X\\(*\\)" : "(" "X*" : "X\\(*\\)" ")"', {OUT => '1'}],
['bre16', '"abc" : "\\(\\)"', {OUT => ''}, {EXIT => 1}],
['bre17', '"{1}a" : "\\(\\{1\\}a\\)"', {OUT => '{1}a'}],
['bre18', '"X*" : "X\\(*\\)" : "^*"', {OUT => '1'}],
['bre19', '"{1}" : "^\\{1\\}"', {OUT => '3'}],
['bre20', '"{" : "{"', {OUT => '1'}],
['bre21', '"abbcbd" : "a\\(b*\\)c\\1d"', {OUT => ''}, {EXIT => 1}],
['bre22', '"abbcbbbd" : "a\\(b*\\)c\\1d"', {OUT => ''}, {EXIT => 1}],
['bre23', '"abc" : "\\(.\\)\\1"', {OUT => ''}, {EXIT => 1}],
['bre24', '"abbccd" : "a\\(\\([bc]\\)\\2\\)*d"', {OUT => 'cc'}],
['bre25', '"abbcbd" : "a\\(\\([bc]\\)\\2\\)*d"',
{OUT => ''}, {EXIT => 1}],
['bre26', '"abbbd" : "a\\(\\(b\\)*\\2\\)*d"', {OUT => 'bbb'}],
['bre27', '"aabcd" : "\\(a\\)\\1bcd"', {OUT => 'a'}],
['bre28', '"aabcd" : "\\(a\\)\\1bc*d"', {OUT => 'a'}],
['bre29', '"aabd" : "\\(a\\)\\1bc*d"', {OUT => 'a'}],
['bre30', '"aabcccd" : "\\(a\\)\\1bc*d"', {OUT => 'a'}],
['bre31', '"aabcccd" : "\\(a\\)\\1bc*[ce]d"', {OUT => 'a'}],
['bre32', '"aabcccd" : "\\(a\\)\\1b\\(c\\)*cd\$"', {OUT => 'a'}],
['bre33', '"a*b" : "a\\(*\\)b"', {OUT => '*'}],
['bre34', '"ab" : "a\\(**\\)b"', {OUT => ''}, {EXIT => 1}],
['bre35', '"ab" : "a\\(***\\)b"', {OUT => ''}, {EXIT => 1}],
['bre36', '"*a" : "*a"', {OUT => '2'}],
['bre37', '"a" : "**a"', {OUT => '1'}],
['bre38', '"a" : "***a"', {OUT => '1'}],
['bre39', '"ab" : "a\\{1\\}b"', {OUT => '2'}],
['bre40', '"ab" : "a\\{1,\\}b"', {OUT => '2'}],
['bre41', '"aab" : "a\\{1,2\\}b"', {OUT => '3'}],
['bre42', '_ : "a\\{1"',
{ERR => "$prog: Unmatched \\{\n"}, {EXIT => 2}],
['bre43', '_ : "a\\{1a"',
{ERR => "$prog: Unmatched \\{\n"}, {EXIT => 2}],
['bre44', '_ : "a\\{1a\\}"',
{ERR => "$prog: Invalid content of \\{\\}\n"}, {EXIT => 2}],
['bre45', '"a" : "a\\{,2\\}"', {OUT => '1'}],
['bre46', '"a" : "a\\{,\\}"', {OUT => '1'}],
['bre47', '_ : "a\\{1,x\\}"',
{ERR => "$prog: Invalid content of \\{\\}\n"}, {EXIT => 2}],
['bre48', '_ : "a\\{1,x"',
{ERR => "$prog: Unmatched \\{\n"}, {EXIT => 2}],
['bre49', '_ : "a\\{32768\\}"',
{ERR => "$prog: Invalid content of \\{\\}\n"}, {EXIT => 2}],
['bre50', '_ : "a\\{1,0\\}"',
{ERR => "$prog: Invalid content of \\{\\}\n"}, {EXIT => 2}],
['bre51', '"acabc" : ".*ab\\{0,0\\}c"', {OUT => '2'}],
['bre52', '"abcac" : "ab\\{0,1\\}c"', {OUT => '3'}],
['bre53', '"abbcac" : "ab\\{0,3\\}c"', {OUT => '4'}],
['bre54', '"abcac" : ".*ab\\{1,1\\}c"', {OUT => '3'}],
['bre55', '"abcac" : ".*ab\\{1,3\\}c"', {OUT => '3'}],
['bre56', '"abbcabc" : ".*ab\{2,2\}c"', {OUT => '4'}],
['bre57', '"abbcabc" : ".*ab\{2,4\}c"', {OUT => '4'}],
['bre58', '"aa" : "a\\{1\\}\\{1\\}"', {OUT => '1'}],
['bre59', '"aa" : "a*\\{1\\}"', {OUT => '2'}],
['bre60', '"aa" : "a\\{1\\}*"', {OUT => '2'}],
['bre61', '"acd" : "a\\(b\\)?c\\1d"', {OUT => ''}, {EXIT => 1}],
['bre62', '-- "-5" : "-\\{0,1\\}[0-9]*\$"', {OUT => '2'}],
['fail-b', '9 9', {ERR => "$prog: syntax error\n"},
{EXIT => 2}],
['fail-c', {ERR => "$prog: missing operand\n"