From deaebdb912cc45ea44cccf469f8fe760d4560635 Mon Sep 17 00:00:00 2001 From: "pschwartau%netscape.com" Date: Thu, 23 Oct 2003 20:48:43 +0000 Subject: [PATCH] Added cases covering unbalanced brackets and braces. git-svn-id: svn://10.0.0.236/trunk@148322 18797224-902f-48f8-a5cc-f745e15eee43 --- .../js/tests/ecma_3/RegExp/regress-223273.js | 65 ++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/mozilla/js/tests/ecma_3/RegExp/regress-223273.js b/mozilla/js/tests/ecma_3/RegExp/regress-223273.js index e661f4bd9e7..6a8ef798f17 100644 --- a/mozilla/js/tests/ecma_3/RegExp/regress-223273.js +++ b/mozilla/js/tests/ecma_3/RegExp/regress-223273.js @@ -35,7 +35,9 @@ * * * Date: 23 October 2003 -* SUMMARY: An unescaped, unbalanced parens in regexp should cause SyntaxError +* SUMMARY: Unescaped, unbalanced parens in a regexp should cause SyntaxError. +* The same should also be true for unescaped, unbalanced brackets or braces. +* * See http://bugzilla.mozilla.org/show_bug.cgi?id=223273 * */ @@ -100,6 +102,67 @@ checkThis(' /(abc([x\)yz]+)def)g/ '); +/* + * Run similar tests as above for unbalanced brackets - + */ +status = inSection(11); +testThis(' /[/ '); + +status = inSection(12); +testThis(' /]/ '); + +status = inSection(13); +testThis(' /[abc\]def[g/ '); + +status = inSection(14); +testThis(' /\[abc]def]g/ '); + + +/* + * These regexp patterns are correct and should not generate + * any errors. Note we use checkThis() instead of testThis(). + */ +status = inSection(15); +checkThis(' /\[/ '); + +status = inSection(16); +checkThis(' /\]/ '); + +status = inSection(17); +checkThis(' /[abc]def\[g/ '); + +status = inSection(18); +checkThis(' /[abc\]def]g/ '); + +status = inSection(19); +checkThis(' /(abc[\]]def)g/ '); + +status = inSection(20); +checkThis(' /[abc(x\]yz+)def]g/ '); + + +/* + * Run the some tests for unbalanced braces - + */ +status = inSection(21); +testThis(' /abc{def/ '); + +status = inSection(22); +testThis(' /abc}def/ '); + + +/* + * These regexp patterns are correct and should not generate + * any errors. Note we use checkThis() instead of testThis(). + */ +status = inSection(23); +checkThis(' /abc\{def/ '); + +status = inSection(24); +checkThis(' /abc\}def/ '); + + + //----------------------------------------------------------------------------- test(); //-----------------------------------------------------------------------------