Adding more tests to cover undefined being non-writable (see https://bugs.ecmascript.org/show_bug.cgi?id=223 )

This commit is contained in:
Bill Ticehurst 2012-05-16 18:08:23 -07:00
parent 8646791add
commit 0dca29de4a
7 changed files with 68 additions and 4 deletions

View File

@ -0,0 +1,22 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch15/15.1/15.1.1/15.1.1.3/15.1.1.3-1.js
* @description undefined is not writable, should not throw in non-strict mode
* @noStrict
*/
function testcase(){
undefined === 5;
if(typeof undefined !== "undefined") return false;
var nosuchproperty;
if(nosuchproperty !== undefined) return false;
return true;
}
runTestCase(testcase);

View File

@ -0,0 +1,26 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch15/15.1/15.1.1/15.1.1.3/15.1.1.3-2.js
* @description undefined is not writable, should throw TypeError in strict mode
* @onlyStrict
*/
function testcase(){
"use strict";
var global = fnGlobalObject();
try{
global["undefined"] = 5; // Should throw a TypeError as per 8.12.5
} catch (ex) {
if(ex instanceof TypeError){
return true;
} else {
return false;
}
}
}
runTestCase(testcase);

View File

@ -0,0 +1,16 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch15/15.1/15.1.1/15.1.1.3/15.1.1.3-3.js
* @description undefined is not writable, simple assignment should return the rval value (11.13.1-6)
*/
function testcase(){
var newProperty = undefined = 42;
return (newProperty === 42);
}
runTestCase(testcase);

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"numTests":11562,"testSuite":["json/ch07.json","json/ch08.json","json/ch09.json","json/ch10.json","json/ch11.json","json/ch12.json","json/ch13.json","json/ch14.json","json/ch15.json"]}
{"numTests":11565,"testSuite":["json/ch07.json","json/ch08.json","json/ch09.json","json/ch10.json","json/ch11.json","json/ch12.json","json/ch13.json","json/ch14.json","json/ch15.json"]}

View File

@ -1 +1 @@
{"date":"2012-05-11","version":"ES5.1"}
{"date":"2012-05-16","version":"ES5.1"}

View File

@ -1 +1 @@
{"numTests":8070,"testSuite":["json/ch15.json"]}
{"numTests":8073,"testSuite":["json/ch15.json"]}