diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/built-ins/global | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/global')
31 files changed, 1011 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/global/10.2.1.1.3-4-16-s-strict.js b/js/src/tests/test262/built-ins/global/10.2.1.1.3-4-16-s-strict.js new file mode 100644 index 0000000000..1b714fd238 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/10.2.1.1.3-4-16-s-strict.js @@ -0,0 +1,18 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.2.1.1.3-4-16-s +description: > + Strict Mode - TypeError is thrown when changing the value of a + Value Property of the Global Object under strict mode (NaN) +flags: [onlyStrict] +---*/ + + +assert.throws(TypeError, function() { + NaN = 12; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/10.2.1.1.3-4-18-s-strict.js b/js/src/tests/test262/built-ins/global/10.2.1.1.3-4-18-s-strict.js new file mode 100644 index 0000000000..c530d38115 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/10.2.1.1.3-4-18-s-strict.js @@ -0,0 +1,18 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.2.1.1.3-4-18-s +description: > + Strict Mode - TypeError is thrown when changing the value of a + Value Property of the Global Object under strict mode (undefined) +flags: [onlyStrict] +---*/ + + +assert.throws(TypeError, function() { + undefined = 12; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/10.2.1.1.3-4-22.js b/js/src/tests/test262/built-ins/global/10.2.1.1.3-4-22.js new file mode 100644 index 0000000000..59e5b5e548 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/10.2.1.1.3-4-22.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.2.1.1.3-4-22-s +description: > + TypeError is not thrown when changing the value of the Constructor Properties + of the Global Object +---*/ + +var objBak = Object; + +try { + Object = 12; +} finally { + Object = objBak; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/10.2.1.1.3-4-27.js b/js/src/tests/test262/built-ins/global/10.2.1.1.3-4-27.js new file mode 100644 index 0000000000..e14e50d435 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/10.2.1.1.3-4-27.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.2.1.1.3-4-27-s +description: > + TypeError is not thrown when changing the value of the Constructor Properties + of the Global Object (Number) +---*/ + +var numBak = Number; +try { + Number = 12; +} finally { + Number = numBak; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S10.2.3_A1.1_T1.js b/js/src/tests/test262/built-ins/global/S10.2.3_A1.1_T1.js new file mode 100644 index 0000000000..9d0e56d236 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S10.2.3_A1.1_T1.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Global object has properties such as built-in objects such as + Math, String, Date, parseInt, etc +es5id: 10.2.3_A1.1_T1 +description: Global execution context - Value Properties +---*/ + +//CHECK#1 +if (NaN === null) { + throw new Test262Error("#1: NaN === null"); +} + +//CHECK#2 +if (Infinity === null) { + throw new Test262Error("#2: Infinity === null"); +} + +//CHECK#3 +if (undefined === null) { + throw new Test262Error("#3: undefined === null"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S10.2.3_A1.1_T2.js b/js/src/tests/test262/built-ins/global/S10.2.3_A1.1_T2.js new file mode 100644 index 0000000000..cc97374cc5 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S10.2.3_A1.1_T2.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Global object has properties such as built-in objects such as + Math, String, Date, parseInt, etc +es5id: 10.2.3_A1.1_T2 +description: Global execution context - Function Properties +---*/ + +//CHECK#4 +if (eval === null) { + throw new Test262Error("#4: eval === null"); +} + +//CHECK#5 +if (parseInt === null) { + throw new Test262Error("#5: parseInt === null"); +} + +//CHECK#6 +if (parseFloat === null) { + throw new Test262Error("#6: parseFloat === null"); +} + +//CHECK#7 +if (isNaN === null) { + throw new Test262Error("#7: isNaN === null"); +} + +//CHECK#8 +if (isFinite === null) { + throw new Test262Error("#8: isFinite === null"); +} + +//CHECK#9 +if (decodeURI === null) { + throw new Test262Error("#9: decodeURI === null"); +} + +//CHECK#10 +if (decodeURIComponent === null) { + throw new Test262Error("#10: decodeURIComponent === null"); +} + +//CHECK#11 +if (encodeURI === null) { + throw new Test262Error("#11: encodeURI === null"); +} + +//CHECK#12 +if (encodeURIComponent === null) { + throw new Test262Error("#12: encodeURIComponent === null"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S10.2.3_A1.1_T3.js b/js/src/tests/test262/built-ins/global/S10.2.3_A1.1_T3.js new file mode 100644 index 0000000000..370029c2a2 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S10.2.3_A1.1_T3.js @@ -0,0 +1,87 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Global object has properties such as built-in objects such as + Math, String, Date, parseInt, etc +es5id: 10.2.3_A1.1_T3 +description: Global execution context - Constructor Properties +---*/ + +//CHECK#13 +if (Object === null) { + throw new Test262Error("#13: Object === null"); +} + +//CHECK#14 +if (Function === null) { + throw new Test262Error("#14: Function === null"); +} + +//CHECK#15 +if (String === null) { + throw new Test262Error("#15: String === null"); +} + +//CHECK#16 +if (Number === null) { + throw new Test262Error("#16: Number === null"); +} + +//CHECK#17 +if (Array === null) { + throw new Test262Error("#17: Array === null"); +} + +//CHECK#18 +if (Boolean === null) { + throw new Test262Error("#20: Boolean === null"); +} + +//CHECK#18 +if (Date === null) { + throw new Test262Error("#18: Date === null"); +} + +//CHECK#19 +if (RegExp === null) { + throw new Test262Error("#19: RegExp === null"); +} + +//CHECK#20 +if (Error === null) { + throw new Test262Error("#20: Error === null"); +} + +//CHECK#21 +if (EvalError === null) { + throw new Test262Error("#21: EvalError === null"); +} + +//CHECK#22 +if (RangeError === null) { + throw new Test262Error("#22: RangeError === null"); +} + +//CHECK#23 +if (ReferenceError === null) { + throw new Test262Error("#23: ReferenceError === null"); +} + +//CHECK#24 +if (SyntaxError === null) { + throw new Test262Error("#24: SyntaxError === null"); +} + +//CHECK#25 +if (TypeError === null) { + throw new Test262Error("#25: TypeError === null"); +} + +//CHECK#26 +if (URIError === null) { + throw new Test262Error("#26: URIError === null"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S10.2.3_A1.1_T4.js b/js/src/tests/test262/built-ins/global/S10.2.3_A1.1_T4.js new file mode 100644 index 0000000000..1fd7b79205 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S10.2.3_A1.1_T4.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: | + Global object has properties such as built-in objects such as + Math, String, Date, parseInt, etc +es5id: 10.2.3_A1.1_T4 +description: Global execution context - Other Properties +---*/ + +//CHECK#27 +if (Math === null) { + throw new Test262Error("#27: Math === null"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S10.2.3_A1.2_T1.js b/js/src/tests/test262/built-ins/global/S10.2.3_A1.2_T1.js new file mode 100644 index 0000000000..b696e46b8f --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S10.2.3_A1.2_T1.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Global object has properties such as built-in objects such as + Math, String, Date, parseInt, etc +es5id: 10.2.3_A1.2_T1 +description: Function execution context - Value Properties +---*/ + +function test() { + //CHECK#1 + if (NaN === null) { + throw new Test262Error("#1: NaN === null"); + } + + //CHECK#2 + if (Infinity === null) { + throw new Test262Error("#2: Infinity === null"); + } + + //CHECK#3 + if (undefined === null) { + throw new Test262Error("#3: undefined === null"); + } +} + +test(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S10.2.3_A1.2_T2.js b/js/src/tests/test262/built-ins/global/S10.2.3_A1.2_T2.js new file mode 100644 index 0000000000..809fe69348 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S10.2.3_A1.2_T2.js @@ -0,0 +1,61 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Global object has properties such as built-in objects such as + Math, String, Date, parseInt, etc +es5id: 10.2.3_A1.2_T2 +description: Function execution context - Function Properties +---*/ + +function test() { + //CHECK#4 + if (eval === null) { + throw new Test262Error("#4: eval === null"); + } + + //CHECK#5 + if (parseInt === null) { + throw new Test262Error("#5: parseInt === null"); + } + + //CHECK#6 + if (parseFloat === null) { + throw new Test262Error("#6: parseFloat === null"); + } + + //CHECK#7 + if (isNaN === null) { + throw new Test262Error("#7: isNaN === null"); + } + + //CHECK#8 + if (isFinite === null) { + throw new Test262Error("#8: isFinite === null"); + } + + //CHECK#9 + if (decodeURI === null) { + throw new Test262Error("#9: decodeURI === null"); + } + + //CHECK#10 + if (decodeURIComponent === null) { + throw new Test262Error("#10: decodeURIComponent === null"); + } + + //CHECK#11 + if (encodeURI === null) { + throw new Test262Error("#11: encodeURI === null"); + } + + //CHECK#12 + if (encodeURIComponent === null) { + throw new Test262Error("#12: encodeURIComponent === null"); + } +} + +test(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S10.2.3_A1.2_T3.js b/js/src/tests/test262/built-ins/global/S10.2.3_A1.2_T3.js new file mode 100644 index 0000000000..2d521c98fb --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S10.2.3_A1.2_T3.js @@ -0,0 +1,91 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Global object has properties such as built-in objects such as + Math, String, Date, parseInt, etc +es5id: 10.2.3_A1.2_T3 +description: Function execution context - Constructor Properties +---*/ + +function test() { + //CHECK#13 + if (Object === null) { + throw new Test262Error("#13: Object === null"); + } + + //CHECK#14 + if (Function === null) { + throw new Test262Error("#14: Function === null"); + } + + //CHECK#15 + if (String === null) { + throw new Test262Error("#15: String === null"); + } + + //CHECK#16 + if (Number === null) { + throw new Test262Error("#16: Function === null"); + } + + //CHECK#17 + if (Array === null) { + throw new Test262Error("#17: Array === null"); + } + + //CHECK#18 + if (Boolean === null) { + throw new Test262Error("#20: Boolean === null"); + } + + //CHECK#18 + if (Date === null) { + throw new Test262Error("#18: Date === null"); + } + + //CHECK#19 + if (RegExp === null) { + throw new Test262Error("#19: RegExp === null"); + } + + //CHECK#20 + if (Error === null) { + throw new Test262Error("#20: Error === null"); + } + + //CHECK#21 + if (EvalError === null) { + throw new Test262Error("#21: EvalError === null"); + } + + //CHECK#22 + if (RangeError === null) { + throw new Test262Error("#22: RangeError === null"); + } + + //CHECK#23 + if (ReferenceError === null) { + throw new Test262Error("#23: ReferenceError === null"); + } + + //CHECK#24 + if (SyntaxError === null) { + throw new Test262Error("#24: SyntaxError === null"); + } + + //CHECK#25 + if (TypeError === null) { + throw new Test262Error("#25: TypeError === null"); + } + + //CHECK#26 + if (URIError === null) { + throw new Test262Error("#26: URIError === null"); + } +} + +test(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S10.2.3_A1.2_T4.js b/js/src/tests/test262/built-ins/global/S10.2.3_A1.2_T4.js new file mode 100644 index 0000000000..b7ce3e41b8 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S10.2.3_A1.2_T4.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Global object has properties such as built-in objects such as + Math, String, Date, parseInt, etc +es5id: 10.2.3_A1.2_T4 +description: Function execution context - Other Properties +---*/ + +function test() { + //CHECK#27 + if (Math === null) { + throw new Test262Error("#27: Math === null"); + } +} + +test(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S10.2.3_A1.3_T1.js b/js/src/tests/test262/built-ins/global/S10.2.3_A1.3_T1.js new file mode 100644 index 0000000000..b5d53d3e50 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S10.2.3_A1.3_T1.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Global object has properties such as built-in objects such as + Math, String, Date, parseInt, etc +es5id: 10.2.3_A1.3_T1 +description: Eval execution context - Value Properties +---*/ + +var evalStr = +'//CHECK#1\n'+ +'if ( NaN === null ) {\n'+ +' throw new Test262Error("#1: NaN === null");\n'+ +'}\n'+ + +'//CHECK#2\n'+ +'if ( Infinity === null ) {\n'+ +' throw new Test262Error("#2: Infinity === null");\n'+ +'}\n'+ + +'//CHECK#3\n'+ +'if ( undefined === null ) {\n'+ +' throw new Test262Error("#3: undefined === null");\n'+ +'}\n'+ +';\n'; + +eval(evalStr); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S10.2.3_A1.3_T2.js b/js/src/tests/test262/built-ins/global/S10.2.3_A1.3_T2.js new file mode 100644 index 0000000000..5ae7631b76 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S10.2.3_A1.3_T2.js @@ -0,0 +1,61 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Global object has properties such as built-in objects such as + Math, String, Date, parseInt, etc +es5id: 10.2.3_A1.3_T2 +description: Eval execution context - Function Properties +---*/ + +var evalStr = +'//CHECK#4\n'+ +'if ( eval === null ) {\n'+ +' throw new Test262Error("#4: eval === null");\n'+ +'}\n'+ + +'//CHECK#5\n'+ +'if ( parseInt === null ) {\n'+ +' throw new Test262Error("#5: parseInt === null");\n'+ +'}\n'+ + +'//CHECK#6\n'+ +'if ( parseFloat === null ) {\n'+ +' throw new Test262Error("#6: parseFloat === null");\n'+ +'}\n'+ + +'//CHECK#7\n'+ +'if ( isNaN === null ) {\n'+ +' throw new Test262Error("#7: isNaN === null");\n'+ +'}\n'+ + +'//CHECK#8\n'+ +'if ( isFinite === null ) {\n'+ +' throw new Test262Error("#8: isFinite === null");\n'+ +'}\n'+ + +'//CHECK#9\n'+ +'if ( decodeURI === null ) {\n'+ +' throw new Test262Error("#9: decodeURI === null");\n'+ +'}\n'+ + +'//CHECK#10\n'+ +'if ( decodeURIComponent === null ) {\n'+ +' throw new Test262Error("#10: decodeURIComponent === null");\n'+ +'}\n'+ + +'//CHECK#11\n'+ +'if ( encodeURI === null ) {\n'+ +' throw new Test262Error("#11: encodeURI === null");\n'+ +'}\n'+ + +'//CHECK#12\n'+ +'if ( encodeURIComponent === null ) {\n'+ +' throw new Test262Error("#12: encodeURIComponent === null");\n'+ +'}\n'+ +';\n'; + +eval(evalStr); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S10.2.3_A1.3_T3.js b/js/src/tests/test262/built-ins/global/S10.2.3_A1.3_T3.js new file mode 100644 index 0000000000..a06365de58 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S10.2.3_A1.3_T3.js @@ -0,0 +1,91 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Global object has properties such as built-in objects such as + Math, String, Date, parseInt, etc +es5id: 10.2.3_A1.3_T3 +description: Eval execution context - Constructor Properties +---*/ + +var evalStr = +'//CHECK#13\n'+ +'if ( Object === null ) {\n'+ +' throw new Test262Error("#13: Object === null");\n'+ +'}\n'+ + +'//CHECK#14\n'+ +'if ( Function === null ) {\n'+ +' throw new Test262Error("#14: Function === null");\n'+ +'}\n'+ + +'//CHECK#15\n'+ +'if ( String === null ) {\n'+ +' throw new Test262Error("#15: String === null");\n'+ +'}\n'+ + +'//CHECK#16\n'+ +'if ( Number === null ) {\n'+ +' throw new Test262Error("#16: Function === null");\n'+ +'}\n'+ + +'//CHECK#17\n'+ +'if ( Array === null ) {\n'+ +' throw new Test262Error("#17: Array === null");\n'+ +'}\n'+ + +'//CHECK#18\n'+ +'if ( Boolean === null ) {\n'+ +' throw new Test262Error("#20: Boolean === null");\n'+ +'}\n'+ + +'//CHECK#18\n'+ +'if ( Date === null ) {\n'+ +' throw new Test262Error("#18: Date === null");\n'+ +'}\n'+ + +'//CHECK#19\n'+ +'if ( RegExp === null ) {\n'+ +' throw new Test262Error("#19: RegExp === null");\n'+ +'}\n'+ + +'//CHECK#20\n'+ +'if ( Error === null ) {\n'+ +' throw new Test262Error("#20: Error === null");\n'+ +'}\n'+ + +'//CHECK#21\n'+ +'if ( EvalError === null ) {\n'+ +' throw new Test262Error("#21: EvalError === null");\n'+ +'}\n'+ + +'//CHECK#22\n'+ +'if ( RangeError === null ) {\n'+ +' throw new Test262Error("#22: RangeError === null");\n'+ +'}\n'+ + +'//CHECK#23\n'+ +'if ( ReferenceError === null ) {\n'+ +' throw new Test262Error("#23: ReferenceError === null");\n'+ +'}\n'+ + +'//CHECK#24\n'+ +'if ( SyntaxError === null ) {\n'+ +' throw new Test262Error("#24: SyntaxError === null");\n'+ +'}\n'+ + +'//CHECK#25\n'+ +'if ( TypeError === null ) {\n'+ +' throw new Test262Error("#25: TypeError === null");\n'+ +'}\n'+ + +'//CHECK#26\n'+ +'if ( URIError === null ) {\n'+ +' throw new Test262Error("#26: URIError === null");\n'+ +'}\n'+ +';\n'; + +eval(evalStr); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S10.2.3_A1.3_T4.js b/js/src/tests/test262/built-ins/global/S10.2.3_A1.3_T4.js new file mode 100644 index 0000000000..c5ba9cc5ff --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S10.2.3_A1.3_T4.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Global object has properties such as built-in objects such as + Math, String, Date, parseInt, etc +es5id: 10.2.3_A1.3_T4 +description: Eval execution context - Other Properties +---*/ + +var evalStr = +'//CHECK#27\n'+ +'if ( Math === null ) {\n'+ +' throw new Test262Error("#27: Math === null");\n'+ +'}\n'+ +';\n'; + +eval(evalStr); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S10.2.3_A2.1_T1.js b/js/src/tests/test262/built-ins/global/S10.2.3_A2.1_T1.js new file mode 100644 index 0000000000..3e03a8384b --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S10.2.3_A2.1_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Global object properties have attributes { DontEnum } +es5id: 10.2.3_A2.1_T1 +description: Global execution context - Value Properties +---*/ + +//CHECK#1 +for (var x in this) { + if (x === 'NaN') { + throw new Test262Error("#1: 'NaN' have attribute DontEnum"); + } else if (x === 'Infinity') { + throw new Test262Error("#1: 'Infinity' have attribute DontEnum"); + } else if (x === 'undefined') { + throw new Test262Error("#1: 'undefined' have attribute DontEnum"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S10.2.3_A2.1_T2.js b/js/src/tests/test262/built-ins/global/S10.2.3_A2.1_T2.js new file mode 100644 index 0000000000..51ff7d470c --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S10.2.3_A2.1_T2.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Global object properties have attributes { DontEnum } +es5id: 10.2.3_A2.1_T2 +description: Global execution context - Function Properties +---*/ + +//CHECK#1 +for (var x in this) { + if (x === 'eval') { + throw new Test262Error("#1: 'eval' have attribute DontEnum"); + } else if (x === 'parseInt') { + throw new Test262Error("#1: 'parseInt' have attribute DontEnum"); + } else if (x === 'parseFloat') { + throw new Test262Error("#1: 'parseFloat' have attribute DontEnum"); + } else if (x === 'isNaN') { + throw new Test262Error("#1: 'isNaN' have attribute DontEnum"); + } else if (x === 'isFinite') { + throw new Test262Error("#1: 'isFinite' have attribute DontEnum"); + } else if (x === 'decodeURI') { + throw new Test262Error("#1: 'decodeURI' have attribute DontEnum"); + } else if (x === 'decodeURIComponent') { + throw new Test262Error("#1: 'decodeURIComponent' have attribute DontEnum"); + } else if (x === 'encodeURI') { + throw new Test262Error("#1: 'encodeURI' have attribute DontEnum"); + } else if (x === 'encodeURIComponent') { + throw new Test262Error("#1: 'encodeURIComponent' have attribute DontEnum"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S10.2.3_A2.1_T3.js b/js/src/tests/test262/built-ins/global/S10.2.3_A2.1_T3.js new file mode 100644 index 0000000000..402381ec19 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S10.2.3_A2.1_T3.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Global object properties have attributes { DontEnum } +es5id: 10.2.3_A2.1_T3 +description: Global execution context - Constructor Properties +---*/ + +//CHECK#1 +for (var x in this) { + if (x === 'Object') { + throw new Test262Error("#1: 'property 'Object' have attribute DontEnum"); + } else if (x === 'Function') { + throw new Test262Error("#1: 'Function' have attribute DontEnum"); + } else if (x === 'String') { + throw new Test262Error("#1: 'String' have attribute DontEnum"); + } else if (x === 'Number') { + throw new Test262Error("#1: 'Number' have attribute DontEnum"); + } else if (x === 'Array') { + throw new Test262Error("#1: 'Array' have attribute DontEnum"); + } else if (x === 'Boolean') { + throw new Test262Error("#1: 'Boolean' have attribute DontEnum"); + } else if (x === 'Date') { + throw new Test262Error("#1: 'Date' have attribute DontEnum"); + } else if (x === 'RegExp') { + throw new Test262Error("#1: 'RegExp' have attribute DontEnum"); + } else if (x === 'Error') { + throw new Test262Error("#1: 'Error' have attribute DontEnum"); + } else if (x === 'EvalError') { + throw new Test262Error("#1: 'EvalError' have attribute DontEnum"); + } else if (x === 'RangeError') { + throw new Test262Error("#1: 'RangeError' have attribute DontEnum"); + } else if (x === 'ReferenceError') { + throw new Test262Error("#1: 'ReferenceError' have attribute DontEnum"); + } else if (x === 'SyntaxError') { + throw new Test262Error("#1: 'SyntaxError' have attribute DontEnum"); + } else if (x === 'TypeError') { + throw new Test262Error("#1: 'TypeError' have attribute DontEnum"); + } else if (x === 'URIError') { + throw new Test262Error("#1: 'URIError' have attribute DontEnum"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S10.2.3_A2.1_T4.js b/js/src/tests/test262/built-ins/global/S10.2.3_A2.1_T4.js new file mode 100644 index 0000000000..b365e2560d --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S10.2.3_A2.1_T4.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: Global object properties have attributes { DontEnum } +es5id: 10.2.3_A2.1_T4 +description: Global execution context - Other Properties +---*/ + +//CHECK#1 +for (var x in this) { + if (x === 'Math') { + throw new Test262Error("#1: 'Math' have attribute DontEnum"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S10.2.3_A2.3_T1.js b/js/src/tests/test262/built-ins/global/S10.2.3_A2.3_T1.js new file mode 100644 index 0000000000..0f3fb4d1ac --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S10.2.3_A2.3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Global object properties have attributes { DontEnum } +es5id: 10.2.3_A2.3_T1 +description: Global execution context - Value Properties +---*/ + +var evalStr = +'//CHECK#1\n'+ +'for (var x in this) {\n'+ +' if ( x === \'NaN\' ) {\n'+ +' throw new Test262Error("#1: \'NaN\' have attribute DontEnum");\n'+ +' } else if ( x === \'Infinity\' ) {\n'+ +' throw new Test262Error("#1: \'Infinity\' have attribute DontEnum");\n'+ +' } else if ( x === \'undefined\' ) {\n'+ +' throw new Test262Error("#1: \'undefined\' have attribute DontEnum");\n'+ +' }\n'+ +'}\n'; + +eval(evalStr); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S10.2.3_A2.3_T2.js b/js/src/tests/test262/built-ins/global/S10.2.3_A2.3_T2.js new file mode 100644 index 0000000000..a1325a94f8 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S10.2.3_A2.3_T2.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Global object properties have attributes { DontEnum } +es5id: 10.2.3_A2.3_T2 +description: Global execution context - Function Properties +---*/ + +var evalStr = +'//CHECK#1\n'+ +'for (var x in this) {\n'+ +' if ( x === \'eval\' ) {\n'+ +' throw new Test262Error("#1: \'eval\' have attribute DontEnum");\n'+ +' } else if ( x === \'parseInt\' ) {\n'+ +' throw new Test262Error("#1: \'parseInt\' have attribute DontEnum");\n'+ +' } else if ( x === \'parseFloat\' ) {\n'+ +' throw new Test262Error("#1: \'parseFloat\' have attribute DontEnum");\n'+ +' } else if ( x === \'isNaN\' ) {\n'+ +' throw new Test262Error("#1: \'isNaN\' have attribute DontEnum");\n'+ +' } else if ( x === \'isFinite\' ) {\n'+ +' throw new Test262Error("#1: \'isFinite\' have attribute DontEnum");\n'+ +' } else if ( x === \'decodeURI\' ) {\n'+ +' throw new Test262Error("#1: \'decodeURI\' have attribute DontEnum");\n'+ +' } else if ( x === \'decodeURIComponent\' ) {\n'+ +' throw new Test262Error("#1: \'decodeURIComponent\' have attribute DontEnum");\n'+ +' } else if ( x === \'encodeURI\' ) {\n'+ +' throw new Test262Error("#1: \'encodeURI\' have attribute DontEnum");\n'+ +' } else if ( x === \'encodeURIComponent\' ) {\n'+ +' throw new Test262Error("#1: \'encodeURIComponent\' have attribute DontEnum");\n'+ +' }\n'+ +'}\n'; + +eval(evalStr); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S10.2.3_A2.3_T3.js b/js/src/tests/test262/built-ins/global/S10.2.3_A2.3_T3.js new file mode 100644 index 0000000000..cc36544593 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S10.2.3_A2.3_T3.js @@ -0,0 +1,48 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Global object properties have attributes { DontEnum } +es5id: 10.2.3_A2.3_T3 +description: Global execution context - Constructor Properties +---*/ + +var evalStr = +'//CHECK#1\n'+ +'for (var x in this) {\n'+ +' if ( x === \'Object\' ) {\n'+ +' throw new Test262Error("#1: \'Object\' have attribute DontEnum");\n'+ +' } else if ( x === \'Function\') {\n'+ +' throw new Test262Error("#1: \'Function\' have attribute DontEnum");\n'+ +' } else if ( x === \'String\' ) {\n'+ +' throw new Test262Error("#1: \'String\' have attribute DontEnum");\n'+ +' } else if ( x === \'Number\' ) {\n'+ +' throw new Test262Error("#1: \'Number\' have attribute DontEnum");\n'+ +' } else if ( x === \'Array\' ) {\n'+ +' throw new Test262Error("#1: \'Array\' have attribute DontEnum");\n'+ +' } else if ( x === \'Boolean\' ) {\n'+ +' throw new Test262Error("#1: \'Boolean\' have attribute DontEnum");\n'+ +' } else if ( x === \'Date\' ) {\n'+ +' throw new Test262Error("#1: \'Date\' have attribute DontEnum");\n'+ +' } else if ( x === \'RegExp\' ) {\n'+ +' throw new Test262Error("#1: \'RegExp\' have attribute DontEnum");\n'+ +' } else if ( x === \'Error\' ) {\n'+ +' throw new Test262Error("#1: \'Error\' have attribute DontEnum");\n'+ +' } else if ( x === \'EvalError\' ) {\n'+ +' throw new Test262Error("#1: \'EvalError\' have attribute DontEnum");\n'+ +' } else if ( x === \'RangeError\' ) {\n'+ +' throw new Test262Error("#1: \'RangeError\' have attribute DontEnum");\n'+ +' } else if ( x === \'ReferenceError\' ) {\n'+ +' throw new Test262Error("#1: \'ReferenceError\' have attribute DontEnum");\n'+ +' } else if ( x === \'SyntaxError\' ) {\n'+ +' throw new Test262Error("#1: \'SyntaxError\' have attribute DontEnum");\n'+ +' } else if ( x === \'TypeError\' ) {\n'+ +' throw new Test262Error("#1: \'TypeError\' have attribute DontEnum");\n'+ +' } else if ( x === \'URIError\' ) {\n'+ +' throw new Test262Error("#1: \'URIError\' have attribute DontEnum");\n'+ +' }\n'+ +'}\n'; + +eval(evalStr); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S10.2.3_A2.3_T4.js b/js/src/tests/test262/built-ins/global/S10.2.3_A2.3_T4.js new file mode 100644 index 0000000000..e0887d2357 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S10.2.3_A2.3_T4.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Global object properties have attributes { DontEnum } +es5id: 10.2.3_A2.3_T4 +description: Global execution context - Other Properties +---*/ + +var evalStr = +'//CHECK#1\n'+ +'for (var x in this) {\n'+ +' if ( x === \'Math\' ) {\n'+ +' throw new Test262Error("#1: \'Math\' have attribute DontEnum");\n'+ +' }\n'+ +'}\n'; + +eval(evalStr); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S15.1_A1_T1.js b/js/src/tests/test262/built-ins/global/S15.1_A1_T1.js new file mode 100644 index 0000000000..b7b72380fd --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S15.1_A1_T1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The global object does not have a [[Construct]] property +es5id: 15.1_A1_T1 +description: > + It is not possible to use the global object as a constructor with + the new operator +---*/ + +var global = this; + +assert.throws(TypeError, function() { + new global; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S15.1_A1_T2.js b/js/src/tests/test262/built-ins/global/S15.1_A1_T2.js new file mode 100644 index 0000000000..d6d314787f --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S15.1_A1_T2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The global object does not have a [[Construct]] property +es5id: 15.1_A1_T2 +description: > + It is not possible to use the global object as a constructor with + the new operator +---*/ + +var global = this; + +assert.throws(TypeError, function() { + new global(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/S15.1_A2_T1.js b/js/src/tests/test262/built-ins/global/S15.1_A2_T1.js new file mode 100644 index 0000000000..b88962b79d --- /dev/null +++ b/js/src/tests/test262/built-ins/global/S15.1_A2_T1.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 global object does not have a [[Call]] property +es5id: 15.1_A2_T1 +description: It is not possible to invoke the global object as a function +---*/ + +var global = this; + +assert.throws(TypeError, function() { + global(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/browser.js b/js/src/tests/test262/built-ins/global/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/browser.js diff --git a/js/src/tests/test262/built-ins/global/global-object.js b/js/src/tests/test262/built-ins/global/global-object.js new file mode 100644 index 0000000000..12b4364511 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/global-object.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 Jordan Harband. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-other-properties-of-the-global-object-globalthis +description: "'globalThis' should be the global object" +author: Jordan Harband +features: [globalThis] +---*/ + +assert.sameValue(this, globalThis); +assert.sameValue(globalThis.globalThis, globalThis); + +assert.sameValue(Array, globalThis.Array); +assert.sameValue(Boolean, globalThis.Boolean); +assert.sameValue(Date, globalThis.Date); +assert.sameValue(Error, globalThis.Error); +assert.sameValue(Function, globalThis.Function); +assert.sameValue(JSON, globalThis.JSON); +assert.sameValue(Math, globalThis.Math); +assert.sameValue(Number, globalThis.Number); +assert.sameValue(RegExp, globalThis.RegExp); +assert.sameValue(String, globalThis.String); + +var globalVariable = {}; +assert.sameValue(globalVariable, globalThis.globalVariable); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/property-descriptor.js b/js/src/tests/test262/built-ins/global/property-descriptor.js new file mode 100644 index 0000000000..6b30ec5c86 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/property-descriptor.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 Jordan Harband. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-other-properties-of-the-global-object-globalthis +description: "'globalThis' should be writable, non-enumerable, and configurable" +author: Jordan Harband +includes: [propertyHelper.js] +features: [globalThis] +---*/ + +verifyProperty(this, "globalThis", { + enumerable: false, + writable: true, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/global/shell.js b/js/src/tests/test262/built-ins/global/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/global/shell.js |