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

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

View File

@ -6,10 +6,11 @@
* @section: 12.14;
* @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;
* @strict_mode_negative SyntaxError;
*/
var myObj = {p1: 'a',
p2: 'b',
var myObj = {p1: 'a',
p2: 'b',
p3: 'c',
value: 'myObj_value',
valueOf : function(){return 'obj_valueOf';},
@ -29,7 +30,7 @@ try{
}
}
catch(e){
if (e!=="ex") $ERROR('#1: Exception ==="ex". Actual: Exception ==='+ e );
if (e!=="ex") $ERROR('#1: Exception ==="ex". Actual: Exception ==='+ e );
}
// CHECK#2

View File

@ -6,11 +6,12 @@
* @section: 12.14;
* @assertion: Sanity test for "catch(Indetifier) statement";
* @description: Checking if deleting an exception fails;
*/
* @strict_mode_negative SyntaxError;
*/
// CHECK#1
try {
throw "catchme";
throw "catchme";
$ERROR('#1.1: throw "catchme" lead to throwing exception');
}
catch (e) {
@ -24,7 +25,7 @@ catch (e) {
// CHECK#2
try {
throw "catchme";
throw "catchme";
$ERROR('#2.1: throw "catchme" lead to throwing exception');
}
catch(e){}

View File

@ -4,10 +4,15 @@
/**
* @name: S12.1_A1;
* @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;
* @negative;
* @negative SyntaxError;
*/
"use strict";
if (!strict_mode) { throw new SyntaxError('unspecified case'); }
{
function __func(){}
}

View File

@ -12,11 +12,11 @@
//////////////////////////////////////////////////////////////////////////////
//CHECK#1
try {
__evaluated = eval("if(1);");
var __evaluated = eval("if(1);");
if (__evaluated !== undefined) {
$ERROR('#1: __evaluated === undefined. Actual: __evaluated ==='+ __evaluated );
}
} catch (e) {
$ERROR('#1.1: "__evaluated = eval("if(1);")" does not lead to throwing exception');

View File

@ -4,11 +4,15 @@
/**
* @name: S12.5_A9_T1;
* @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;
* @negative;
* @negative SyntaxError;
*/
"use strict";
if (!strict_mode) { throw new SyntaxError('unspecified case'); }
if (true) {
function __func(){};
} else {

View File

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

View File

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

View File

@ -4,11 +4,15 @@
/**
* @name: S12.6.1_A13_T1;
* @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;
* @negative;
* @negative SyntaxError;
*/
"use strict";
if (!strict_mode) { throw new SyntaxError('unspecified case'); }
do{
function __func(){};
} while(0);

View File

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

View File

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

View File

@ -13,7 +13,7 @@ if (!(Function.prototype.toString.hasOwnProperty('length'))) {
$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";};

View File

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