Updating Google contribution to r97 of sputniktests.

This commit is contained in:
Mark Miller 2011-06-27 08:52:25 -06:00
parent 02e7fb9cfa
commit a230618291
14 changed files with 70 additions and 46 deletions

View File

@ -6,7 +6,8 @@
* @section: 12.10; * @section: 12.10;
* @assertion: No matter how control leaves the embedded 'Statement', * @assertion: No matter how control leaves the embedded 'Statement',
* the scope chain is always restored to its former state; * the scope chain is always restored to its former state;
* @description: Declaring "with" statement within a function constructor, leading to completion by exception; * @description: Declaring "with" statement within a function
* constructor, leading to completion by exception;
* @strict_mode_negative * @strict_mode_negative
*/ */
@ -18,15 +19,16 @@ var myObj = {
p1: 'a', p1: 'a',
value: 'myObj_value', value: 'myObj_value',
valueOf : function(){return 'obj_valueOf';} valueOf : function(){return 'obj_valueOf';}
};
function __FACTORY(){
with(myObj){
var p1 = 'x1';
throw value;
}
} }
try { try {
function __FACTORY(){
with(myObj){
p1 = 'x1';
throw value;
}
}
var obj = new __FACTORY(); var obj = new __FACTORY();
} catch(e){ } catch(e){
result = p1; result = p1;
@ -34,7 +36,7 @@ try {
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#1 //CHECK#1
if(result !== 1){ if (result !== 1) {
$ERROR('#1: result === 1. Actual: result ==='+ result ); $ERROR('#1: result === 1. Actual: result ==='+ result );
} }
// //
@ -42,7 +44,7 @@ if(result !== 1){
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#2 //CHECK#2
if(p1 !== 1){ if (p1 !== 1) {
$ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 );
} }
// //
@ -50,7 +52,7 @@ if(p1 !== 1){
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#3 //CHECK#3
if(myObj.p1 !== "x1"){ if (myObj.p1 !== "x1") {
$ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
} }
// //

View File

@ -6,6 +6,7 @@
* @section: 12.14; * @section: 12.14;
* @assertion: Using "try" with "catch" or "finally" statement within/without a "with" statement; * @assertion: Using "try" with "catch" or "finally" statement within/without a "with" statement;
* @description: Using try/catch/finally in With and With in try/catch/finally; * @description: Using try/catch/finally in With and With in try/catch/finally;
* @strict_mode_negative SyntaxError;
*/ */
var myObj = {p1: 'a', var myObj = {p1: 'a',

View File

@ -6,6 +6,7 @@
* @section: 12.14; * @section: 12.14;
* @assertion: Sanity test for "catch(Indetifier) statement"; * @assertion: Sanity test for "catch(Indetifier) statement";
* @description: Checking if deleting an exception fails; * @description: Checking if deleting an exception fails;
* @strict_mode_negative SyntaxError;
*/ */
// CHECK#1 // CHECK#1

View File

@ -4,10 +4,15 @@
/** /**
* @name: S12.1_A1; * @name: S12.1_A1;
* @section: 12.1; * @section: 12.1;
* @assertion: The production Block { } can't contain function declaration; * @assertion: The production Block { } in strict code can't contain
* function declaration;
* @description: Trying to declare function at the Block statement; * @description: Trying to declare function at the Block statement;
* @negative; * @negative SyntaxError;
*/ */
"use strict";
if (!strict_mode) { throw new SyntaxError('unspecified case'); }
{ {
function __func(){} function __func(){}
} }

View File

@ -12,7 +12,7 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#1 //CHECK#1
try { try {
__evaluated = eval("if(1);"); var __evaluated = eval("if(1);");
if (__evaluated !== undefined) { if (__evaluated !== undefined) {
$ERROR('#1: __evaluated === undefined. Actual: __evaluated ==='+ __evaluated ); $ERROR('#1: __evaluated === undefined. Actual: __evaluated ==='+ __evaluated );
} }

View File

@ -4,11 +4,15 @@
/** /**
* @name: S12.5_A9_T1; * @name: S12.5_A9_T1;
* @section: 12.5; * @section: 12.5;
* @assertion: Function declaration within an "if" statement is not allowed; * @assertion: Function declaration within an "if" statement in strict
* code is not allowed;
* @description: Declaring function within an "if" statement; * @description: Declaring function within an "if" statement;
* @negative; * @negative SyntaxError;
*/ */
"use strict";
if (!strict_mode) { throw new SyntaxError('unspecified case'); }
if (true) { if (true) {
function __func(){}; function __func(){};
} else { } else {

View File

@ -4,12 +4,15 @@
/** /**
* @name: S12.5_A9_T2; * @name: S12.5_A9_T2;
* @section: 12.5; * @section: 12.5;
* @assertion: Function declaration within an "if" statement is not allowed; * @assertion: Function declaration within an "if" statement in strict
* @description: Declaring function within and "if" that is declared within the function call; * code is not allowed;
* @negative; * @description: Declaring function within an "if" that is declared
* within the strict function;
* @negative SyntaxError;
*/ */
(function(){ (function(){
"use strict";
if (true) { if (true) {
function __func(){}; function __func(){};
@ -17,4 +20,4 @@ if (true) {
function __func(){}; function __func(){};
} }
})(); });

View File

@ -8,6 +8,8 @@
* @description: Evaluating various Expressions; * @description: Evaluating various Expressions;
*/ */
var __in__do;
do __in__do=1; while ( false ); do __in__do=1; while ( false );
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -4,11 +4,15 @@
/** /**
* @name: S12.6.1_A13_T1; * @name: S12.6.1_A13_T1;
* @section: 12.6.1, 13; * @section: 12.6.1, 13;
* @assertion: FunctionDeclaration within a "do-while" Block is not allowed; * @assertion: FunctionDeclaration within a "do-while" Block in strict
* code is not allowed;
* @description: Declaring function within a "do-while" loop; * @description: Declaring function within a "do-while" loop;
* @negative; * @negative SyntaxError;
*/ */
"use strict";
if (!strict_mode) { throw new SyntaxError('unspecified case'); }
do{ do{
function __func(){}; function __func(){};
} while(0); } while(0);

View File

@ -4,15 +4,17 @@
/** /**
* @name: S12.6.1_A13_T2; * @name: S12.6.1_A13_T2;
* @section: 12.6.1, 13; * @section: 12.6.1, 13;
* @assertion: FunctionDeclaration within a "do-while" Block is not allowed; * @assertion: FunctionDeclaration within a "do-while" Block in strict
* @description: Declaring a function within a "do-while" loop that is within a function call; * code is not allowed;
* @negative; * @description: Declaring a function within a "do-while" loop that is
* within a strict function;
* @negative SyntaxError;
*/ */
(function(){ (function(){
"use strict";
do{ do{
function __func(){}; function __func(){};
}while(0); }while(0);
})(); });

View File

@ -9,4 +9,4 @@
* @negative * @negative
*/ */
Object.prototype.toLocaleString.call(undefined); Object.prototype.valueOf.call(undefined);

View File

@ -9,4 +9,4 @@
* @negative * @negative
*/ */
Object.prototype.toLocaleString.call(null); Object.prototype.valueOf.call(null);

View File

@ -13,7 +13,7 @@ if (!(Function.prototype.toString.hasOwnProperty('length'))) {
$FAIL('#1: the Function.prototype.toString has length property.'); $FAIL('#1: the Function.prototype.toString has length property.');
} }
obj = Function.prototype.toString.length; var obj = Function.prototype.toString.length;
Function.prototype.toString.length = function(){return "shifted";}; Function.prototype.toString.length = function(){return "shifted";};

View File

@ -8,9 +8,9 @@
* @description: For testing use Function.prototype.toString() function; * @description: For testing use Function.prototype.toString() function;
*/ */
f = function(x) { var f = function(x) {
return x*x; return x*x;
} };
//CHECK#1 //CHECK#1
if (eval(f.toString())(10) !== f(10)) { if (eval(f.toString())(10) !== f(10)) {