mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 21:05:36 +00:00
Added cases covering unbalanced brackets and braces.
This commit is contained in:
parent
054eaeb6fc
commit
d04a86445e
@ -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();
|
||||
//-----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user