diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/undefined')
10 files changed, 145 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/undefined/15.1.1.3-0.js b/js/src/tests/test262/built-ins/undefined/15.1.1.3-0.js new file mode 100644 index 0000000000..ade5d4723b --- /dev/null +++ b/js/src/tests/test262/built-ins/undefined/15.1.1.3-0.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-undefined +description: > + Global.undefined is a data property with default attribute values + (false) +---*/ + +var desc = Object.getOwnPropertyDescriptor(this, 'undefined'); + +assert.sameValue(desc.writable, false, 'desc.writable'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); +assert.sameValue(desc.configurable, false, 'desc.configurable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/undefined/15.1.1.3-1.js b/js/src/tests/test262/built-ins/undefined/15.1.1.3-1.js new file mode 100644 index 0000000000..187ea80c35 --- /dev/null +++ b/js/src/tests/test262/built-ins/undefined/15.1.1.3-1.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-undefined +description: undefined is not writable, should not throw in non-strict mode +flags: [noStrict] +---*/ + +undefined = 5; +assert.sameValue(typeof undefined, "undefined", 'typeof undefined'); + +var nosuchproperty; +assert.sameValue(nosuchproperty, undefined, 'nosuchproperty'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/undefined/15.1.1.3-2-strict.js b/js/src/tests/test262/built-ins/undefined/15.1.1.3-2-strict.js new file mode 100644 index 0000000000..aee4796cbe --- /dev/null +++ b/js/src/tests/test262/built-ins/undefined/15.1.1.3-2-strict.js @@ -0,0 +1,19 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-undefined +description: undefined is not writable, should throw TypeError in strict mode +flags: [onlyStrict] +---*/ + +var global = this; + +assert.throws(TypeError, function() { + global["undefined"] = 5; // Should throw a TypeError as per 8.12.5 +}); +assert.sameValue(global["undefined"], void 0); +assert.sameValue(undefined, void 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/undefined/15.1.1.3-3.js b/js/src/tests/test262/built-ins/undefined/15.1.1.3-3.js new file mode 100644 index 0000000000..c773f422ed --- /dev/null +++ b/js/src/tests/test262/built-ins/undefined/15.1.1.3-3.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-undefined +description: > + undefined is not writable, simple assignment should return the + rval value (11.13.1-6) +flags: [noStrict] +---*/ + +var newProperty = undefined = 42; + +assert.sameValue(newProperty, 42, 'newProperty'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/undefined/S15.1.1.3_A1.js b/js/src/tests/test262/built-ins/undefined/S15.1.1.3_A1.js new file mode 100644 index 0000000000..ea0a7303dd --- /dev/null +++ b/js/src/tests/test262/built-ins/undefined/S15.1.1.3_A1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The initial value of undefined is undefined +esid: sec-undefined +description: Use typeof, isNaN, isFinite +---*/ + +// CHECK#1 +if (typeof(undefined) !== "undefined") { + throw new Test262Error('#1: typeof(undefined) === "undefined". Actual: ' + (typeof(undefined))); +} + +// CHECK#2 +if (undefined !== void 0) { + throw new Test262Error('#2: undefined === void 0. Actual: ' + (undefined)); +} + +// CHECK#3 +if (undefined !== eval("var x")) { + throw new Test262Error('#3: undefined === eval("var x"). Actual: ' + (undefined)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/undefined/S15.1.1.3_A3_T2.js b/js/src/tests/test262/built-ins/undefined/S15.1.1.3_A3_T2.js new file mode 100644 index 0000000000..9c1fa9598d --- /dev/null +++ b/js/src/tests/test262/built-ins/undefined/S15.1.1.3_A3_T2.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The undefined is DontDelete +esid: sec-undefined +description: Use delete +flags: [noStrict] +---*/ + +// CHECK#1 +if (delete undefined !== false) { + throw new Test262Error('#1: delete undefined === false. Actual: ' + (delete undefined)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/undefined/S15.1.1.3_A4.js b/js/src/tests/test262/built-ins/undefined/S15.1.1.3_A4.js new file mode 100644 index 0000000000..7a337afc2a --- /dev/null +++ b/js/src/tests/test262/built-ins/undefined/S15.1.1.3_A4.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The undefined is DontEnum +esid: sec-undefined +description: Use for-in statement +---*/ + +// CHECK#1 +for (var prop in this) { + if (prop === "undefined") { + throw new Test262Error('#1: The undefined is DontEnum'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/undefined/browser.js b/js/src/tests/test262/built-ins/undefined/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/undefined/browser.js diff --git a/js/src/tests/test262/built-ins/undefined/prop-desc.js b/js/src/tests/test262/built-ins/undefined/prop-desc.js new file mode 100644 index 0000000000..320a0a2a3c --- /dev/null +++ b/js/src/tests/test262/built-ins/undefined/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2019 Bocoup. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-undefined +description: Property descriptor of undefined +info: | + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +---*/ + +verifyProperty(this, "undefined", { + enumerable: false, + writable: false, + configurable: false +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/undefined/shell.js b/js/src/tests/test262/built-ins/undefined/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/undefined/shell.js |