Bug 531972: Add parent dir jstests.list entries; call reportCompare as needed; fix anonymous function objects in js/src/tests/ecma_5/strict/13.1.js. r=bclary, r=mrbkap

While prior patches created new test directories
js/src/tests/ecma_5/strict and js/src/tests/js1_8_1/strict, they
failed to add jstests.list entries to their parent directories. This
adds them.

The strict tests generally were written to use assertEq, which is
simple and gives nice source positions in failure messages under the
JS shell. However, the jsreftests require each test file to call
reportCompare at least once. This adds a dummy call to reportCompare
to each file. It would be nice to make everything work in both
environments, perhaps using arguments.caller.

The test script js/src/tests/ecma_5/strict/13.1.js tried parsing
statements of the form 'function(x,x){}'. However, anonymous function
expressions are not allowed in a statement context when
JSOPTION_ANONFUNFIX is set. This is set under the browser, but clear
in the shell; bug 532233 suggests that the two be reconciled.
This commit is contained in:
Jim Blandy 2009-12-02 15:13:14 -08:00
parent 05b34d7c12
commit dbab286e15
24 changed files with 55 additions and 9 deletions

View File

@ -1,2 +1,3 @@
include Date/jstests.list
include Object/jstests.list
include strict/jstests.list

View File

@ -34,3 +34,5 @@ assertEq(completesNormally("Function('010')"),
true);
assertEq(raisesException(SyntaxError)("Function('\"use strict\"; 010')"),
true);
reportCompare(true, true);

View File

@ -138,3 +138,5 @@ assertEq(testLenientAndStrict('({x getter: function() {}, x getter: function() {
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
reportCompare(true, true);

View File

@ -25,3 +25,5 @@ assertEq(testLenientAndStrict('(eval)=1',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
reportCompare(true, true);

View File

@ -25,3 +25,5 @@ assertEq(testLenientAndStrict('(eval)+=1',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
reportCompare(true, true);

View File

@ -25,3 +25,5 @@ assertEq(testLenientAndStrict('(eval)++',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
reportCompare(true, true);

View File

@ -25,3 +25,5 @@ assertEq(testLenientAndStrict('(eval)--',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
reportCompare(true, true);

View File

@ -37,3 +37,5 @@ assertEq(testLenientAndStrict('function f() { "use strict"; delete x; }',
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
reportCompare(true, true);

View File

@ -25,3 +25,5 @@ assertEq(testLenientAndStrict('++(eval)',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
reportCompare(true, true);

View File

@ -25,3 +25,5 @@ assertEq(testLenientAndStrict('--(eval)',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
reportCompare(true, true);

View File

@ -26,3 +26,5 @@ assertEq(testLenientAndStrict('function f() { "use strict"; with (1) {} }',
*/
assertEq(parsesSuccessfully('function f() { "use strict"; }; with (1) {}'),
true);
reportCompare(true, true);

View File

@ -33,3 +33,5 @@ assertEq(testLenientAndStrict('try{}catch({x:arguments}){}',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
reportCompare(true, true);

View File

@ -21,3 +21,5 @@ assertEq(testLenientAndStrict('var x,arguments;',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
reportCompare(true, true);

View File

@ -14,21 +14,21 @@
* The parameters of ordinary function definitions should not contain
* duplicate identifiers.
*/
assertEq(testLenientAndStrict('function(x,y) {}',
assertEq(testLenientAndStrict('function f(x,y) {}',
parsesSuccessfully,
parsesSuccessfully),
true);
assertEq(testLenientAndStrict('function(x,x) {}',
assertEq(testLenientAndStrict('function f(x,x) {}',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('function(x,y,z,y) {}',
assertEq(testLenientAndStrict('function f(x,y,z,y) {}',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
/* Exercise the hashed local name map case. */
assertEq(testLenientAndStrict('function(a,b,c,d,e,f,g,h,d) {}',
assertEq(testLenientAndStrict('function f(a,b,c,d,e,f,g,h,d) {}',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
@ -37,15 +37,15 @@ assertEq(testLenientAndStrict('function(a,b,c,d,e,f,g,h,d) {}',
* SpiderMonkey has always treated duplicates in destructuring
* patterns as an error. Strict mode should not affect this.
*/
assertEq(testLenientAndStrict('function([x,y]) {}',
assertEq(testLenientAndStrict('function f([x,y]) {}',
parsesSuccessfully,
parsesSuccessfully),
true);
assertEq(testLenientAndStrict('function([x,x]){}',
assertEq(testLenientAndStrict('function f([x,x]){}',
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('function(x,[x]){}',
assertEq(testLenientAndStrict('function f(x,[x]){}',
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
@ -54,7 +54,7 @@ assertEq(testLenientAndStrict('function(x,[x]){}',
* Strict rules apply to the parameters if the function's body is
* strict.
*/
assertEq(testLenientAndStrict('function(x,x) { "use strict" };',
assertEq(testLenientAndStrict('function f(x,x) { "use strict" };',
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
@ -410,3 +410,5 @@ assertEq(testLenientAndStrict('Function("arguments","\'use strict\';")',
raisesException(SyntaxError)),
true);
reportCompare(true, true);

View File

@ -35,3 +35,5 @@ assertEq(testLenientAndStrict('undeclared_at_compiletime=1',
parsesSuccessfully,
parsesSuccessfully),
true);
reportCompare(true, true);

View File

@ -27,3 +27,5 @@ assertEq(parsesSuccessfully('function f() { "use strict"; }; 010'),
/* Octal integer literal in function body */
assertEq(parsesSuccessfully('function f() { 010; }'),
true);
reportCompare(true, true);

View File

@ -34,3 +34,5 @@ assertEq(testLenientAndStrict('"\\0x"',
parsesSuccessfully,
parsesSuccessfully),
true);
reportCompare(true, true);

View File

@ -45,4 +45,6 @@ assertEq(isSyntaxError("function f(a,b,c,d,e,f,g,h,b,[y]){}"), true);
assertEq(isSyntaxError("function f([y],a,b,c,d,e,f,g,h,a){}"), true);
assertEq(isSyntaxError("function f([a],b,c,d,e,f,g,h,i,a){}"), true);
assertEq(isSyntaxError("function f(a,b,c,d,e,f,g,h,i,[a]){}"), true);
reportCompare(isSyntaxError("function f(a,b,c,d,e,f,g,h,i,[a]){}"), true);
assertEq(isSyntaxError("function f(a,b,c,d,e,f,g,h,i,[a]){}"), true);
reportCompare(true, true);

View File

@ -3,4 +3,5 @@ include extensions/jstests.list
include JSON/jstests.list
include regress/jstests.list
include String/jstests.list
include strict/jstests.list
include trace/jstests.list

View File

@ -66,3 +66,5 @@ function test()
exitFunc ('test');
}
reportCompare(true, true);

View File

@ -70,3 +70,5 @@ assertEq(testLenientAndStrict('for (let {x:arguments} in [])break;',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
reportCompare(true, true);

View File

@ -12,3 +12,5 @@ assertEq(testLenientAndStrict('let let_declared; let_declared=1',
completesNormally,
completesNormally),
true);
reportCompare(true, true);

View File

@ -33,3 +33,5 @@ assertEq(testLenientAndStrict('(1 for ({x:arguments} in []))',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
reportCompare(true, true);

View File

@ -30,3 +30,5 @@ assertEq(testLenientAndStrict('let ({x:arguments}=1) {}',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
reportCompare(true, true);