diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/language/expressions/compound-assignment | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/expressions/compound-assignment')
456 files changed, 17692 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-1-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-1-s.js new file mode 100644 index 0000000000..860b8ea7f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-1-s.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. + +/*--- +es5id: 11.13.2-1-s +description: > + ReferenceError is thrown if the LeftHandSideExpression of a Compound + Assignment operator(*=) evaluates to an unresolvable reference +---*/ + + +assert.throws(ReferenceError, function() { + eval("_11_13_2_1 *= 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-10-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-10-s.js new file mode 100644 index 0000000000..2faafbc2c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-10-s.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. + +/*--- +es5id: 11.13.2-10-s +description: > + ReferenceError is thrown if the LeftHandSideExpression of a Compound + Assignment operator(^=) evaluates to an unresolvable reference +---*/ + + +assert.throws(ReferenceError, function() { + eval("_11_13_2_10 ^= 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-11-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-11-s.js new file mode 100644 index 0000000000..eacdde129d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-11-s.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. + +/*--- +es5id: 11.13.2-11-s +description: > + ReferenceError is thrown if the LeftHandSideExpression of a Compound + Assignment operator(|=) evaluates to an unresolvable reference +---*/ + + +assert.throws(ReferenceError, function() { + eval("_11_13_2_11 |= 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-12-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-12-s.js new file mode 100644 index 0000000000..64140e987a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-12-s.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. + +/*--- +es5id: 11.13.2-12-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(*=) evaluates to a resolvable reference +---*/ + + var _11_13_2_12 = 5 + _11_13_2_12 *= 2; + +assert.sameValue(_11_13_2_12, 10, '_11_13_2_12'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-13-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-13-s.js new file mode 100644 index 0000000000..fb49371147 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-13-s.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. + +/*--- +es5id: 11.13.2-13-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(/=) evaluates to a resolvable reference +---*/ + + var _11_13_2_13 = 6 + _11_13_2_13 /= 2; + +assert.sameValue(_11_13_2_13, 3, '_11_13_2_13'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-14-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-14-s.js new file mode 100644 index 0000000000..e765268f7d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-14-s.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. + +/*--- +es5id: 11.13.2-14-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(%=) evaluates to a resolvable reference +---*/ + + var _11_13_2_14 = 5 + _11_13_2_14 %= 2; + +assert.sameValue(_11_13_2_14, 1, '_11_13_2_14'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-15-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-15-s.js new file mode 100644 index 0000000000..7ddb8bc132 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-15-s.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. + +/*--- +es5id: 11.13.2-15-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(>>>=) evaluates to a resolvable reference +---*/ + + var _11_13_2_15 = 8 + _11_13_2_15 >>>= 2; + +assert.sameValue(_11_13_2_15, 2, '_11_13_2_15'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-16-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-16-s.js new file mode 100644 index 0000000000..33163dc7a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-16-s.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. + +/*--- +es5id: 11.13.2-16-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(-=) evaluates to a resolvable reference +---*/ + + var _11_13_2_16 = 5 + _11_13_2_16 -= 2; + +assert.sameValue(_11_13_2_16, 3, '_11_13_2_16'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-17-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-17-s.js new file mode 100644 index 0000000000..6ad052276d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-17-s.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. + +/*--- +es5id: 11.13.2-17-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(<<=) evaluates to a resolvable reference +---*/ + + var _11_13_2_17 = 1; + _11_13_2_17 <<= 2; + +assert.sameValue(_11_13_2_17, 4, '_11_13_2_17'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-18-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-18-s.js new file mode 100644 index 0000000000..75bd0d8e4f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-18-s.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. + +/*--- +es5id: 11.13.2-18-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(>>=) evaluates to a resolvable reference +---*/ + + var _11_13_2_18 = 4 + _11_13_2_18 >>= 2; + +assert.sameValue(_11_13_2_18, 1, '_11_13_2_18'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-19-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-19-s.js new file mode 100644 index 0000000000..dfe7f7f8e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-19-s.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. + +/*--- +es5id: 11.13.2-19-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(+=) evaluates to a resolvable reference +---*/ + + var _11_13_2_19 = -1 + _11_13_2_19 += 10; + +assert.sameValue(_11_13_2_19, 9, '_11_13_2_19'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-2-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-2-s.js new file mode 100644 index 0000000000..a5010a29ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-2-s.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. + +/*--- +es5id: 11.13.2-2-s +description: > + Strict Mode - ReferenceError is thrown if the LeftHandSideExpression of a + Compound Assignment operator(/=) evaluates to an unresolvable reference +---*/ + + +assert.throws(ReferenceError, function() { + eval("_11_13_2_2 /= 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-20-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-20-s.js new file mode 100644 index 0000000000..dbecd1e14d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-20-s.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. + +/*--- +es5id: 11.13.2-20-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(&=) evaluates to a resolvable reference +---*/ + + var _11_13_2_20 = 5 + _11_13_2_20 &= 3; + +assert.sameValue(_11_13_2_20, 1, '_11_13_2_20'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-21-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-21-s.js new file mode 100644 index 0000000000..525d3374a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-21-s.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. + +/*--- +es5id: 11.13.2-21-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(^=) evaluates to a resolvable reference +---*/ + + var _11_13_2_21 = 5 + _11_13_2_21 ^= 3; + +assert.sameValue(_11_13_2_21, 6, '_11_13_2_21'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-22-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-22-s.js new file mode 100644 index 0000000000..e8fd2bac20 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-22-s.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. + +/*--- +es5id: 11.13.2-22-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(|=) evaluates to a resolvable reference +---*/ + + var _11_13_2_22 = 5 + _11_13_2_22 |= 2; + +assert.sameValue(_11_13_2_22, 7, '_11_13_2_22'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-23-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-23-s-strict.js new file mode 100644 index 0000000000..dbfb3f9fdb --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-23-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-23-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(*=) is a reference to a data property + with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop *= 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-24-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-24-s-strict.js new file mode 100644 index 0000000000..4f827d66c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-24-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-24-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(/=) is a reference to a data property + with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop /= 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-25-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-25-s-strict.js new file mode 100644 index 0000000000..761ab24cc4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-25-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-25-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(%=) is a reference to a data property + with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop %= 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-26-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-26-s-strict.js new file mode 100644 index 0000000000..63d5b60be3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-26-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-26-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(+=) is a reference to a data property + with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop += 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-27-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-27-s-strict.js new file mode 100644 index 0000000000..ac762ff2f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-27-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-27-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(-=) is a reference to a data property + with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop -= 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-28-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-28-s-strict.js new file mode 100644 index 0000000000..ab81ebf7e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-28-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-28-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(<<=) is a reference to a data + property with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop <<= 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-29-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-29-s-strict.js new file mode 100644 index 0000000000..2f532dcc83 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-29-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-29-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(>>=) is a reference to a data + property with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop >>= 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-30-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-30-s-strict.js new file mode 100644 index 0000000000..e4be71b5bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-30-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-30-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(>>>=) is a reference to a data + property with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop >>>= 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-31-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-31-s-strict.js new file mode 100644 index 0000000000..151abacdd2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-31-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-31-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(&=) is a reference to a data property + with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop &= 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-32-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-32-s-strict.js new file mode 100644 index 0000000000..8c3f5cc145 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-32-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-32-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(^=) is a reference to a data property + with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop ^= 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-33-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-33-s-strict.js new file mode 100644 index 0000000000..a8bf7c873a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-33-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-33-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(|=) is a reference to a data property + with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop |= 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-34-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-34-s-strict.js new file mode 100644 index 0000000000..d000837723 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-34-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-34-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(*=) is a reference to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop *= 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-35-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-35-s-strict.js new file mode 100644 index 0000000000..4b30aabdf9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-35-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-35-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(/=) is a reference to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop /= 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-36-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-36-s-strict.js new file mode 100644 index 0000000000..0a475a6aad --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-36-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-36-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(%=) is a reference to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop %= 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-37-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-37-s-strict.js new file mode 100644 index 0000000000..46ca3ff608 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-37-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-37-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(+=) is a reference to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop += 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-38-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-38-s-strict.js new file mode 100644 index 0000000000..392974d4c7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-38-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-38-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(-=) is a reference to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop -= 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-39-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-39-s-strict.js new file mode 100644 index 0000000000..c23720a86b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-39-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-39-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(<<=) is a reference to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop <<= 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-4-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-4-s.js new file mode 100644 index 0000000000..1bb1260b96 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-4-s.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. + +/*--- +es5id: 11.13.2-4-s +description: > + Strict Mode - ReferenceError is thrown if the + LeftHandSideExpression of a Compound Assignment operator(+=) + evaluates to an unresolvable reference +---*/ + + +assert.throws(ReferenceError, function() { + eval("_11_13_2_4 += 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-40-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-40-s-strict.js new file mode 100644 index 0000000000..04bc4602d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-40-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-40-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(>>=) is a reference to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop >>= 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-41-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-41-s-strict.js new file mode 100644 index 0000000000..29d9c2fe21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-41-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-41-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(>>>=) is a reference to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop >>>= 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-42-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-42-s-strict.js new file mode 100644 index 0000000000..5e5a07de71 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-42-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-42-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(&=) is a reference to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop &= 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-43-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-43-s-strict.js new file mode 100644 index 0000000000..4a0468bd15 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-43-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-43-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(^=) is a reference to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop ^= 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-44-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-44-s-strict.js new file mode 100644 index 0000000000..8264e12584 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-44-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-44-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(|=) is a reference of to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop |= 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-45-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-45-s-strict.js new file mode 100644 index 0000000000..3e6aca427d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-45-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-45-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(*=) is a reference to a non-existent + property of an object whose [[Extensible]] internal property is + false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len *= 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-46-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-46-s-strict.js new file mode 100644 index 0000000000..fe68ee8985 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-46-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-46-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(/=) is a reference to a non-existent + property of an object whose [[Extensible]] internal property is + false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len /= 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-47-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-47-s-strict.js new file mode 100644 index 0000000000..8b9086b469 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-47-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-47-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(%=) is a reference to a non-existent + property of an object whose [[Extensible]] internal property is + false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len %= 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-48-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-48-s-strict.js new file mode 100644 index 0000000000..89ec389e67 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-48-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-48-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(+=) is a reference to a non-existent + property of an object whose [[Extensible]] internal property is + false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len += 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-49-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-49-s-strict.js new file mode 100644 index 0000000000..5636fadc11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-49-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-49-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(-=) is a reference to a non-existent + property of an object whose [[Extensible]] internal property is + false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len -= 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-5-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-5-s.js new file mode 100644 index 0000000000..ec5931d0e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-5-s.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. + +/*--- +es5id: 11.13.2-5-s +description: > + Strict Mode - ReferenceError is thrown if the + LeftHandSideExpression of a Compound Assignment operator(-=) + evaluates to an unresolvable reference +---*/ + + +assert.throws(ReferenceError, function() { + eval("_11_13_2_5 -= 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-50-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-50-s-strict.js new file mode 100644 index 0000000000..a3ddae6c1a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-50-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-50-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(<<=) is a reference to a non-existent + property of an object whose [[Extensible]] internal property is + false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len <<= 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-51-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-51-s-strict.js new file mode 100644 index 0000000000..e257753fff --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-51-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-51-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(>>=) is a reference to a non-existent + property of an object whose [[Extensible]] internal property is + false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len >>= 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-52-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-52-s-strict.js new file mode 100644 index 0000000000..650f489673 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-52-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-52-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(>>>=) is a reference to a + non-existent property of an object whose [[Extensible]] internal + property if false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len >>>= 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-53-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-53-s-strict.js new file mode 100644 index 0000000000..4ba94616ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-53-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-53-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(&=) is a reference to a non-existent + property of an object whose [[Extensible]] internal property is + false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len &= 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-54-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-54-s-strict.js new file mode 100644 index 0000000000..3f50e7bd1a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-54-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-54-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(^=) is a reference to a non-existent + property of an object whose [[Extensible]] internal property is + false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len ^= 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-55-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-55-s-strict.js new file mode 100644 index 0000000000..f3e49586aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-55-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-55-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(|=) is a reference to a non-existent + property of an object whose [[Extensible]] internal property is + false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len |= 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-6-1gs-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-6-1gs-strict.js new file mode 100644 index 0000000000..e8aa0127d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-6-1gs-strict.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-1gs +description: > + Strict Mode - SyntaxError is throw if the identifier eval appears + as the LeftHandSideExpression of a Compound Assignment operator(*=) +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +eval *= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-6-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-6-s.js new file mode 100644 index 0000000000..9e3576dfcb --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-6-s.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. + +/*--- +es5id: 11.13.2-6-s +description: > + Strict Mode - ReferenceError is thrown if the + LeftHandSideExpression of a Compound Assignment operator(<<=) + evaluates to an unresolvable reference +---*/ + + +assert.throws(ReferenceError, function() { + eval("_11_13_2_6 <<= 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-8-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-8-s.js new file mode 100644 index 0000000000..820436d1dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-8-s.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. + +/*--- +es5id: 11.13.2-8-s +description: > + Strict Mode - ReferenceError is thrown if the + LeftHandSideExpression of a Compound Assignment operator(>>>=) + evaluates to an unresolvable reference +---*/ + + +assert.throws(ReferenceError, function() { + eval("_11_13_2_8 >>>= 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-9-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-9-s.js new file mode 100644 index 0000000000..19586dc2ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-9-s.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. + +/*--- +es5id: 11.13.2-9-s +description: > + Strict Mode - ReferenceError is thrown if the + LeftHandSideExpression of a Compound Assignment operator(&=) + evaluates to an unresolvable reference +---*/ + + +assert.throws(ReferenceError, function() { + eval("_11_13_2_9 &= 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.1.js new file mode 100644 index 0000000000..7e2334171d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.1.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.1 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x *= y" +---*/ + +//CHECK#1 +var x = 1; +var z = (x *= -1); +if (z !== -1) { + throw new Test262Error('#1: var x = 1; var z = (x *= -1); z === -1. Actual: ' + (z)); +} + +//CHECK#2 +var x = 1; +var y = -1; +var z = (x *= y); +if (z !== -1) { + throw new Test262Error('#2: var x = 1; var y = -1; var z = (x *= y); z === -1. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.10.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.10.js new file mode 100644 index 0000000000..c5be69d568 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.10.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.10 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x ^= y" +---*/ + +//CHECK#1 +var x = 1; +var z = (x ^= 1); +if (z !== 0) { + throw new Test262Error('#1: var x = 1; var z = (x ^= 1); z === 0. Actual: ' + (z)); +} + +//CHECK#2 +var x = 1; +var y = 1; +var z = (x ^= y); +if (z !== 0) { + throw new Test262Error('#2: var x = 1; var y = 1; var z = (x ^= y); z === 0. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.11.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.11.js new file mode 100644 index 0000000000..210c91c8d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.11.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.11 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x |= y" +---*/ + +//CHECK#1 +var x = 0; +var z = (x |= 1); +if (z !== 1) { + throw new Test262Error('#1: var x = 0; var z = (x |= 1); z === 1. Actual: ' + (z)); +} + +//CHECK#2 +var x = 0; +var y = 1; +var z = (x |= y); +if (z !== 1) { + throw new Test262Error('#2: var x = 0; var y = 1; var z = (x |= y); z === 1. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.2.js new file mode 100644 index 0000000000..955514fd90 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.2.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.2 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x /= y" +---*/ + +//CHECK#1 +var x = 1; +var z = (x /= -1); +if (z !== -1) { + throw new Test262Error('#1: var x = 1; var z = (x /= -1); z === -1. Actual: ' + (z)); +} + +//CHECK#2 +var x = 1; +var y = -1; +var z = (x /= y); +if (z !== -1) { + throw new Test262Error('#2: var x = 1; var y = -1; var z = (x /= y); z === -1. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.3.js new file mode 100644 index 0000000000..f7ca64f6f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.3.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.3 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x %= y" +---*/ + +//CHECK#1 +var x = -1; +var z = (x %= 2); +if (z !== -1) { + throw new Test262Error('#1: var x = -1; var z = (x %= 2); z === -1. Actual: ' + (z)); +} + +//CHECK#2 +var x = -1; +var y = 2; +var z = (x %= y); +if (z !== -1) { + throw new Test262Error('#2: var x = -1; var y = 2; var z = (x %= y); z === -1. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.4.js new file mode 100644 index 0000000000..0bd848bd88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.4.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.4 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x += y" +---*/ + +//CHECK#1 +var x = 1; +var z = (x += 1); +if (z !== 2) { + throw new Test262Error('#1: var x = 1; var z = (x += 1); z === 2. Actual: ' + (z)); +} + +//CHECK#2 +var x = 1; +var y = 1; +var z = (x += y); +if (z !== 2) { + throw new Test262Error('#2: var x = 1; var y = 1; var z = (x += y); z === 2. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.5.js new file mode 100644 index 0000000000..9e35143575 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.5.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.5 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x -= y" +---*/ + +//CHECK#1 +var x = 1; +var z = (x -= 1); +if (z !== 0) { + throw new Test262Error('#1: var x = 1; var z = (x -= 1); z === 0. Actual: ' + (z)); +} + +//CHECK#2 +var x = 1; +var y = 1; +var z = (x -= y); +if (z !== 0) { + throw new Test262Error('#2: var x = 1; var y = 1; var z = (x -= y); z === 0. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.6.js new file mode 100644 index 0000000000..8f6a835c17 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.6.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.6 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x <<= y" +---*/ + +//CHECK#1 +var x = 1; +var z = (x <<= 1); +if (z !== 2) { + throw new Test262Error('#1: var x = 1; var z = (x <<= 1); z === 2. Actual: ' + (z)); +} + +//CHECK#2 +var x = 1; +var y = 1; +var z = (x <<= y); +if (z !== 2) { + throw new Test262Error('#2: var x = 1; var y = 1; var z = (x <<= y); z === 2. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.7.js new file mode 100644 index 0000000000..844b57e2b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.7.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.7 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x >>= y" +---*/ + +//CHECK#1 +var x = 4; +var z = (x >>= 1); +if (z !== 2) { + throw new Test262Error('#1: var x = 4; var z = (x >>= 1); z === 2. Actual: ' + (z)); +} + +//CHECK#2 +var x = 4; +var y = 1; +var z = (x >>= y); +if (z !== 2) { + throw new Test262Error('#2: var x = 4; var y = 1; var z = (x >>= y); z === 2. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.8.js new file mode 100644 index 0000000000..88a43f406b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.8.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.8 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x >>>= y" +---*/ + +//CHECK#1 +var x = 4; +var z = (x >>>= 1); +if (z !== 2) { + throw new Test262Error('#1: var x = 4; var z = (x >>>= 1); z === 2. Actual: ' + (z)); +} + +//CHECK#2 +var x = 4; +var y = 1; +var z = (x >>>= y); +if (z !== 2) { + throw new Test262Error('#2: var x = 4; var y = 1; var z = (x >>>= y); z === 2. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.9.js new file mode 100644 index 0000000000..c51adfbd94 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.9.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.9 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x &= y" +---*/ + +//CHECK#1 +var x = 1; +var z = (x &= 1); +if (z !== 1) { + throw new Test262Error('#1: var x = 1; var z = (x &= 1); z === 1. Actual: ' + (z)); +} + +//CHECK#2 +var x = 1; +var y = 1; +var z = (x &= y); +if (z !== 1) { + throw new Test262Error('#2: var x = 1; var y = 1; var z = (x &= y); z === 1. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.1.js new file mode 100644 index 0000000000..b9a3dace1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.1.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.1 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x *= y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x *= y); + throw new Test262Error('#1.1: var x = 1; x *= y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x *= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.10.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.10.js new file mode 100644 index 0000000000..2875b2aac7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.10.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.10 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x ^= y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x ^= y); + throw new Test262Error('#1.1: var x = 1; x ^= y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x ^= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.11.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.11.js new file mode 100644 index 0000000000..72f3178b67 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.11.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.11 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x |= y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x |= y); + throw new Test262Error('#1.1: var x = 1; x |= y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x |= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.2.js new file mode 100644 index 0000000000..b029bb82b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.2.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.2 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x /= y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x /= y); + throw new Test262Error('#1.1: var x = 1; x /= y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x /= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.3.js new file mode 100644 index 0000000000..8a26baad37 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.3.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.3 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x %= y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x %= y); + throw new Test262Error('#1.1: var x = 1; x %= y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x %= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.4.js new file mode 100644 index 0000000000..1c64664556 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.4.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.4 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x += y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x += y); + throw new Test262Error('#1.1: var x = 1; x += y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x += y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.5.js new file mode 100644 index 0000000000..59e817b30c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.5.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.5 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x -= y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x -= y); + throw new Test262Error('#1.1: var x = 1; x -= y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x -= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.6.js new file mode 100644 index 0000000000..458dea846d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.6.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.6 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x <<= y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x <<= y); + throw new Test262Error('#1.1: var x = 1; x <<= y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x <<= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.7.js new file mode 100644 index 0000000000..68a2753fbf --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.7.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.7 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x >>= y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x >>= y); + throw new Test262Error('#1.1: var x = 1; x >>= y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x >>= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.8.js new file mode 100644 index 0000000000..009e557a1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.8.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.8 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x >>>= y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x >>>= y); + throw new Test262Error('#1.1: var x = 1; x >>>= y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x >>>= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.9.js new file mode 100644 index 0000000000..118605d529 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.9.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: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.9 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x &= y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x &= y); + throw new Test262Error('#1.1: var x = 1; x &= y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x &= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.1.js new file mode 100644 index 0000000000..672f6fde95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.1.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.1 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x *= y" +---*/ + +//CHECK#1 +try { + var z = (x *= 1); + throw new Test262Error('#1.1: x *= 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x *= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.10.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.10.js new file mode 100644 index 0000000000..eb372f48b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.10.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.10 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x ^= y" +---*/ + +//CHECK#1 +try { + var z = (x ^= 1); + throw new Test262Error('#1.1: x ^= 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x ^= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.11.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.11.js new file mode 100644 index 0000000000..b312c4d1d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.11.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.11 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x |= y" +---*/ + +//CHECK#1 +try { + var z = (x |= 1); + throw new Test262Error('#1.1: x |= 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x |= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.2.js new file mode 100644 index 0000000000..a6b251d30c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.2.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.2 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x /= y" +---*/ + +//CHECK#1 +try { + var z = (x /= 1); + throw new Test262Error('#1.1: x /= 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x /= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.3.js new file mode 100644 index 0000000000..9719a44a6e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.3.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.3 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x %= y" +---*/ + +//CHECK#1 +try { + var z = (x %= 1); + throw new Test262Error('#1.1: x %= 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x %= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.4.js new file mode 100644 index 0000000000..1decafce4f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.4.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.4 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x += y" +---*/ + +//CHECK#1 +try { + var z = (x += 1); + throw new Test262Error('#1.1: x += 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x += 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.5.js new file mode 100644 index 0000000000..da86bb97ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.5.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.5 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x -= y" +---*/ + +//CHECK#1 +try { + var z = (x -= 1); + throw new Test262Error('#1.1: x -= 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x -= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.6.js new file mode 100644 index 0000000000..5c8b00b534 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.6.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.6 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x <<= y" +---*/ + +//CHECK#1 +try { + var z = (x <<= 1); + throw new Test262Error('#1.1: x <<= 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x <<= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.7.js new file mode 100644 index 0000000000..4bde0847bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.7.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.7 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x >>= y" +---*/ + +//CHECK#1 +try { + var z = (x >>= 1); + throw new Test262Error('#1.1: x >>= 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x >>= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.8.js new file mode 100644 index 0000000000..8b765b8d4a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.8.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.8 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x >>>= y" +---*/ + +//CHECK#1 +try { + var z = (x >>>= 1); + throw new Test262Error('#1.1: x >>>= 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x >>>= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.9.js new file mode 100644 index 0000000000..cce71d8b81 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.9.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.9 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x &= y" +---*/ + +//CHECK#1 +try { + var z = (x &= 1); + throw new Test262Error('#1.1: x &= 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x &= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T1.js new file mode 100644 index 0000000000..5a33755c68 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T1.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: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T1 +description: Checking Expression and Variable statements for x *= y +---*/ + +//CHECK#1 +var x = 1; +x *= -1; +if (x !== -1) { + throw new Test262Error('#1: var x = 1; x *= -1; x === -1. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = 1; +y *= -1; +if (y !== -1) { + throw new Test262Error('#2: y = 1; y *= -1; y === -1. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T10.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T10.js new file mode 100644 index 0000000000..7b096ad917 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T10.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: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T10 +description: Checking Expression and Variable statements for x ^= y +---*/ + +//CHECK#1 +var x = 0; +x ^= 1; +if (x !== 1) { + throw new Test262Error('#1: var x = 0; x ^= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = 1; +y ^= 0; +if (y !== 1) { + throw new Test262Error('#2: y = 1; y ^= 0; y === 1. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T11.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T11.js new file mode 100644 index 0000000000..eb777834cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T11.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: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T11 +description: Checking Expression and Variable statements for x |= y +---*/ + +//CHECK#1 +var x = 0; +x |= 1; +if (x !== 1) { + throw new Test262Error('#1: var x = 0; x |= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = 1; +y |= 0; +if (y !== 1) { + throw new Test262Error('#2: y = 1; y |= 0; y === 1. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T2.js new file mode 100644 index 0000000000..d5e22f4a6d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T2.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: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T2 +description: Checking Expression and Variable statements for x /= y +---*/ + +//CHECK#1 +var x = 1; +x /= -1; +if (x !== -1) { + throw new Test262Error('#1: var x = 1; x /= -1; x === -1. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = 1; +y /= -1; +if (y !== -1) { + throw new Test262Error('#2: y = 1; y /= -1; y === -1. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T3.js new file mode 100644 index 0000000000..ef6eed7edc --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T3.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: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T3 +description: Checking Expression and Variable statements for x %= y +---*/ + +//CHECK#1 +var x = -1; +x %= 2; +if (x !== -1) { + throw new Test262Error('#1: var x = -1; x %= 2; x === -1. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = -1; +y %= 2; +if (y !== -1) { + throw new Test262Error('#2: y = -1; y %= 2; y === -1. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T4.js new file mode 100644 index 0000000000..0c4fe2b2c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T4.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: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T4 +description: Checking Expression and Variable statements for x += y +---*/ + +//CHECK#1 +var x = 1; +x += 1; +if (x !== 2) { + throw new Test262Error('#1: var x = 1; x += 1; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = 1; +y += 1; +if (y !== 2) { + throw new Test262Error('#2: y = 1; y += 1; y === 2. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T5.js new file mode 100644 index 0000000000..6a532210d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T5.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: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T5 +description: Checking Expression and Variable statements for x -= y +---*/ + +//CHECK#1 +var x = -1; +x -= 1; +if (x !== -2) { + throw new Test262Error('#1: var x = -1; x -= 1; x === -2. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = -1; +y -= 1; +if (y !== -2) { + throw new Test262Error('#2: y = -1; y -= 1; y === -2. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T6.js new file mode 100644 index 0000000000..7809b7bb3d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T6.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: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T6 +description: Checking Expression and Variable statements for x <<= y +---*/ + +//CHECK#1 +var x = 1; +x <<= 1; +if (x !== 2) { + throw new Test262Error('#1: var x = 1; x <<= 1; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = 1; +y <<= 1; +if (y !== 2) { + throw new Test262Error('#2: y = 1; y <<= 1; y === 2. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T7.js new file mode 100644 index 0000000000..b3c807623c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T7.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: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T7 +description: Checking Expression and Variable statements for x >>= y +---*/ + +//CHECK#1 +var x = 4; +x >>= 1; +if (x !== 2) { + throw new Test262Error('#1: var x = 4; x >>= 1; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = 4; +y >>= 1; +if (y !== 2) { + throw new Test262Error('#2: y = 4; y >>= 1; y === 2. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T8.js new file mode 100644 index 0000000000..8acd706ac1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T8.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: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T8 +description: Checking Expression and Variable statements for x >>>= y +---*/ + +//CHECK#1 +var x = 4; +x >>>= 1; +if (x !== 2) { + throw new Test262Error('#1: var x = 4; x >>>= 1; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = 4; +y >>>= 1; +if (y !== 2) { + throw new Test262Error('#2: y = 4; y >>>= 1; y === 2. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T9.js new file mode 100644 index 0000000000..54c5a9fdca --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T9.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: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T9 +description: Checking Expression and Variable statements for x &= y +---*/ + +//CHECK#1 +var x = 1; +x &= 1; +if (x !== 1) { + throw new Test262Error('#1: var x = 1; x &= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = 1; +y &= 1; +if (y !== 1) { + throw new Test262Error('#2: y = 1; y &= 1; y === 1. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T1.js new file mode 100644 index 0000000000..1e3c5cfdc0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T1 +description: Checking Expression and Variable statements for x *= y +---*/ + +//CHECK#1 +var x = 1; +var x1 = (x *= -1); +if (x1 !== -1) { + throw new Test262Error('#1: var x = 1; var x1 = (x *= -1); x1 === -1. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = 1; +y1 = (y *= -1); +if (y1 !== -1) { + throw new Test262Error('#2: y = 1; y1 = (y *= -1); y1 === -1. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T10.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T10.js new file mode 100644 index 0000000000..71c96aec95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T10.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T10 +description: Checking Expression and Variable statements for x ^= y +---*/ + +//CHECK#1 +var x = 0; +var x1 = (x ^= 1); +if (x1 !== 1) { + throw new Test262Error('#1: var x = 0; var x1 = (x ^= 1); x1 === 1. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = 1; +y1 = (y ^= 0); +if (y1 !== 1) { + throw new Test262Error('#2: y = 1; y1 = (y ^= 0); y1 === 1. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T11.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T11.js new file mode 100644 index 0000000000..801efd8781 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T11.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T11 +description: Checking Expression and Variable statements for x |= y +---*/ + +//CHECK#1 +var x = 0; +var x1 = (x |= 1); +if (x1 !== 1) { + throw new Test262Error('#1: var x = 0; var x1 = (x |= 1); x1 === 1. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = 1; +y1 = (y |= 0); +if (y1 !== 1) { + throw new Test262Error('#2: y = 1; y1 = (y |= 0); y1 === 1. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T2.js new file mode 100644 index 0000000000..29389a74e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T2 +description: Checking Expression and Variable statements for x /= y +---*/ + +//CHECK#1 +var x = 1; +var x1 = (x /= -1); +if (x1 !== -1) { + throw new Test262Error('#1: var x = 1; var x1 = (x /= -1); x1 === -1. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = 1; +y1 = (y /= -1); +if (y1 !== -1) { + throw new Test262Error('#2: y = 1; y1 = (y /= -1); y1 === -1. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T3.js new file mode 100644 index 0000000000..9664e4aa20 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T3.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T3 +description: Checking Expression and Variable statements for x %= y +---*/ + +//CHECK#1 +var x = -1; +var x1 = (x %= 2); +if (x1 !== -1) { + throw new Test262Error('#1: var x = -1; var x1 = (x %= 2); x1 === -1. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = -1; +y1 = (y %= 2); +if (y1 !== -1) { + throw new Test262Error('#2: y = -1; y1 = (y %= 2); y1 === -1. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T4.js new file mode 100644 index 0000000000..a9af22d470 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T4.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T4 +description: Checking Expression and Variable statements for x += y +---*/ + +//CHECK#1 +var x = 1; +var x1 = (x += 1); +if (x1 !== 2) { + throw new Test262Error('#1: var x = 1; var x1 = (x += 1); x1 === 2. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = 1; +y1 = (y += 1); +if (y1 !== 2) { + throw new Test262Error('#2: y = 1; y1 = (y += 1); y1 === 2. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T5.js new file mode 100644 index 0000000000..139229e652 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T5.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T5 +description: Checking Expression and Variable statements for x -= y +---*/ + +//CHECK#1 +var x = -1; +var x1 = (x -= 1); +if (x1 !== -2) { + throw new Test262Error('#1: var x = -1; var x1 = (x -= 1); x1 === -2. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = -1; +y1 = (y -= 1); +if (y1 !== -2) { + throw new Test262Error('#2: y = -1; y1 = (y -= 1); y1 === -2. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T6.js new file mode 100644 index 0000000000..39115cd993 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T6.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T6 +description: Checking Expression and Variable statements for x <<= y +---*/ + +//CHECK#1 +var x = 1; +var x1 = (x <<= 1); +if (x1 !== 2) { + throw new Test262Error('#1: var x = 1; var x1 = (x <<= 1); x1 === 2. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = 1; +y1 = (y <<= 1); +if (y1 !== 2) { + throw new Test262Error('#2: y = 1; y1 = (y <<= 1); y1 === 2. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T7.js new file mode 100644 index 0000000000..01a95c1c62 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T7.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T7 +description: Checking Expression and Variable statements for x >>= y +---*/ + +//CHECK#1 +var x = 4; +var x1 = (x >>= 1); +if (x1 !== 2) { + throw new Test262Error('#1: var x = 4; var x1 = (x >>= 1); x1 === 2. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = 4; +y1 = (y >>= 1); +if (y1 !== 2) { + throw new Test262Error('#2: y = 4; y1 = (y >>= 1); y1 === 2. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T8.js new file mode 100644 index 0000000000..5991068ce5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T8.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T8 +description: Checking Expression and Variable statements for x >>>= y +---*/ + +//CHECK#1 +var x = 4; +var x1 = (x >>>= 1); +if (x1 !== 2) { + throw new Test262Error('#1: var x = 4; var x1 = (x >>>= 1); x1 === 2. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = 4; +y1 = (y >>>= 1); +if (y1 !== 2) { + throw new Test262Error('#2: y = 4; y1 = (y >>>= 1); y1 === 2. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T9.js new file mode 100644 index 0000000000..9c35b70a38 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T9.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T9 +description: Checking Expression and Variable statements for x &= y +---*/ + +//CHECK#1 +var x = 1; +var x1 = (x &= 1); +if (x1 !== 1) { + throw new Test262Error('#1: var x = 1; var x1 = (x &= 1); x1 === 1. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = 1; +y1 = (y &= 1); +if (y1 !== 1) { + throw new Test262Error('#2: y = 1; y1 = (y &= 1); y1 === 1. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.1.js new file mode 100644 index 0000000000..f5ed53e39d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x ^= true; +if (x !== 0) { + throw new Test262Error('#1: x = true; x ^= true; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x ^= true; +if (x !== 0) { + throw new Test262Error('#2: x = new Boolean(true); x ^= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x ^= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#3: x = true; x ^= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x ^= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = new Boolean(true); x ^= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.2.js new file mode 100644 index 0000000000..0d9f200b9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x ^= 1; +if (x !== 0) { + throw new Test262Error('#1: x = 1; x ^= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x ^= 1; +if (x !== 0) { + throw new Test262Error('#2: x = new Number(1); x ^= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x ^= new Number(1); +if (x !== 0) { + throw new Test262Error('#3: x = 1; x ^= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x ^= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = new Number(1); x ^= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.3.js new file mode 100644 index 0000000000..4315a394ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x ^= "1"; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x ^= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x ^= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = new String("1"); x ^= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x ^= new String("1"); +if (x !== 0) { + throw new Test262Error('#3: x = "1"; x ^= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x ^= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = new String("1"); x ^= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = "x"; +x ^= "1"; +if (x !== 1) { + throw new Test262Error('#5: x = "x"; x ^= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x ^= "x"; +if (x !== 1) { + throw new Test262Error('#6: x = "1"; x ^= "x"; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.4.js new file mode 100644 index 0000000000..78ae6f1f5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.4.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x ^= undefined; +if (x !== 0) { + throw new Test262Error('#1: x = null; x ^= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x ^= null; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x ^= null; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x ^= undefined; +if (x !== 0) { + throw new Test262Error('#3: x = undefined; x ^= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x ^= null; +if (x !== 0) { + throw new Test262Error('#4: x = null; x ^= null; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.1.js new file mode 100644 index 0000000000..4cc67d1bd6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x ^= 1; +if (x !== 0) { + throw new Test262Error('#1: x = true; x ^= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x ^= true; +if (x !== 0) { + throw new Test262Error('#2: x = 1; x ^= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x ^= 1; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x ^= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x ^= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = 1; x ^= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x ^= new Number(1); +if (x !== 0) { + throw new Test262Error('#5: x = true; x ^= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x ^= true; +if (x !== 0) { + throw new Test262Error('#6: x = new Number(1); x ^= true; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x ^= new Number(1); +if (x !== 0) { + throw new Test262Error('#7: x = new Boolean(true); x ^= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x ^= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#8: x = new Number(1); x ^= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.2.js new file mode 100644 index 0000000000..6d669da838 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.2.js @@ -0,0 +1,84 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x ^= 1; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x ^= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x ^= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = 1; x ^= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x ^= 1; +if (x !== 0) { + throw new Test262Error('#3: x = new String("1"); x ^= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x ^= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = 1; x ^= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x ^= new Number(1); +if (x !== 0) { + throw new Test262Error('#5: x = "1"; x ^= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x ^= "1"; +if (x !== 0) { + throw new Test262Error('#6: x = new Number(1); x ^= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x ^= new Number(1); +if (x !== 0) { + throw new Test262Error('#7: x = new String("1"); x ^= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x ^= new String("1"); +if (x !== 0) { + throw new Test262Error('#8: x = new Number(1); x ^= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#9 +x = "x"; +x ^= 1; +if (x !== 1) { + throw new Test262Error('#9: x = "x"; x ^= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x ^= "x"; +if (x !== 1) { + throw new Test262Error('#10: x = 1; x ^= "x"; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.3.js new file mode 100644 index 0000000000..579dcf893d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x ^= null; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x ^= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x ^= 1; +if (x !== 1) { + throw new Test262Error('#2: x = null; x ^= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x ^= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x ^= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x ^= new Number(1); +if (x !== 1) { + throw new Test262Error('#4: x = null; x ^= new Number(1); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.4.js new file mode 100644 index 0000000000..389e982aef --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x ^= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x ^= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x ^= 1; +if (x !== 1) { + throw new Test262Error('#2: x = undefined; x ^= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x ^= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x ^= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x ^= new Number(1); +if (x !== 1) { + throw new Test262Error('#4: x = undefined; x ^= new Number(1); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.5.js new file mode 100644 index 0000000000..40d3a4fedd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.5.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x ^= "1"; +if (x !== 0) { + throw new Test262Error('#1: x = true; x ^= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x ^= true; +if (x !== 0) { + throw new Test262Error('#2: x = "1"; x ^= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x ^= "1"; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x ^= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x ^= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = "1"; x ^= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x ^= new String("1"); +if (x !== 0) { + throw new Test262Error('#5: x = true; x ^= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x ^= true; +if (x !== 0) { + throw new Test262Error('#6: x = new String("1"); x ^= true; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x ^= new String("1"); +if (x !== 0) { + throw new Test262Error('#7: x = new Boolean(true); x ^= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x ^= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#8: x = new String("1"); x ^= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.6.js new file mode 100644 index 0000000000..c226a3003d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.6.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x ^= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x ^= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x ^= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = undefined; x ^= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x ^= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x ^= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x ^= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = undefined; x ^= new String("1"); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.7.js new file mode 100644 index 0000000000..9d12bf3de0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.7.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x ^= null; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x ^= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x ^= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = null; x ^= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x ^= null; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x ^= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x ^= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = null; x ^= new String("1"); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.8.js new file mode 100644 index 0000000000..1481976090 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x ^= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = true; x ^= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x ^= true; +if (x !== 1) { + throw new Test262Error('#2: x = undefined; x ^= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x ^= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x ^= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x ^= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = undefined; x ^= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.9.js new file mode 100644 index 0000000000..b176bc590b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x ^= null; +if (x !== 1) { + throw new Test262Error('#1: x = true; x ^= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x ^= true; +if (x !== 1) { + throw new Test262Error('#2: x = null; x ^= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x ^= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x ^= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x ^= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = null; x ^= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.1.js new file mode 100644 index 0000000000..fd1591fbce --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x |= true; +if (x !== 1) { + throw new Test262Error('#1: x = true; x |= true; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x |= true; +if (x !== 1) { + throw new Test262Error('#2: x = new Boolean(true); x |= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x |= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#3: x = true; x |= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x |= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = new Boolean(true); x |= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.2.js new file mode 100644 index 0000000000..b093bf01ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x |= 1; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x |= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x |= 1; +if (x !== 1) { + throw new Test262Error('#2: x = new Number(1); x |= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x |= new Number(1); +if (x !== 1) { + throw new Test262Error('#3: x = 1; x |= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x |= new Number(1); +if (x !== 1) { + throw new Test262Error('#4: x = new Number(1); x |= new Number(1); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.3.js new file mode 100644 index 0000000000..ef852129d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x |= "1"; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x |= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x |= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = new String("1"); x |= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x |= new String("1"); +if (x !== 1) { + throw new Test262Error('#3: x = "1"; x |= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x |= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = new String("1"); x |= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = "x"; +x |= "1"; +if (x !== 1) { + throw new Test262Error('#5: x = "x"; x |= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x |= "x"; +if (x !== 1) { + throw new Test262Error('#6: x = "1"; x |= "x"; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.4.js new file mode 100644 index 0000000000..86f3b083f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.4.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x |= undefined; +if (x !== 0) { + throw new Test262Error('#1: x = null; x |= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x |= null; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x |= null; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x |= undefined; +if (x !== 0) { + throw new Test262Error('#3: x = undefined; x |= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x |= null; +if (x !== 0) { + throw new Test262Error('#4: x = null; x |= null; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.1.js new file mode 100644 index 0000000000..1ada0dc500 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x |= 1; +if (x !== 1) { + throw new Test262Error('#1: x = true; x |= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x |= true; +if (x !== 1) { + throw new Test262Error('#2: x = 1; x |= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x |= 1; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x |= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x |= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = 1; x |= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x |= new Number(1); +if (x !== 1) { + throw new Test262Error('#5: x = true; x |= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x |= true; +if (x !== 1) { + throw new Test262Error('#6: x = new Number(1); x |= true; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x |= new Number(1); +if (x !== 1) { + throw new Test262Error('#7: x = new Boolean(true); x |= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x |= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#8: x = new Number(1); x |= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.2.js new file mode 100644 index 0000000000..5434dddd0e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.2.js @@ -0,0 +1,84 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x |= 1; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x |= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x |= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = 1; x |= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x |= 1; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x |= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x |= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = 1; x |= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x |= new Number(1); +if (x !== 1) { + throw new Test262Error('#5: x = "1"; x |= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x |= "1"; +if (x !== 1) { + throw new Test262Error('#6: x = new Number(1); x |= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x |= new Number(1); +if (x !== 1) { + throw new Test262Error('#7: x = new String("1"); x |= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x |= new String("1"); +if (x !== 1) { + throw new Test262Error('#8: x = new Number(1); x |= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#9 +x = "x"; +x |= 1; +if (x !== 1) { + throw new Test262Error('#9: x = "x"; x |= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x |= "x"; +if (x !== 1) { + throw new Test262Error('#10: x = 1; x |= "x"; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.3.js new file mode 100644 index 0000000000..2b76e7201b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x |= null; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x |= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x |= 1; +if (x !== 1) { + throw new Test262Error('#2: x = null; x |= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x |= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x |= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x |= new Number(1); +if (x !== 1) { + throw new Test262Error('#4: x = null; x |= new Number(1); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.4.js new file mode 100644 index 0000000000..8b98072e98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x |= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x |= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x |= 1; +if (x !== 1) { + throw new Test262Error('#2: x = undefined; x |= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x |= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x |= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x |= new Number(1); +if (x !== 1) { + throw new Test262Error('#4: x = undefined; x |= new Number(1); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.5.js new file mode 100644 index 0000000000..9b5da8785b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.5.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x |= "1"; +if (x !== 1) { + throw new Test262Error('#1: x = true; x |= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x |= true; +if (x !== 1) { + throw new Test262Error('#2: x = "1"; x |= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x |= "1"; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x |= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x |= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = "1"; x |= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x |= new String("1"); +if (x !== 1) { + throw new Test262Error('#5: x = true; x |= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x |= true; +if (x !== 1) { + throw new Test262Error('#6: x = new String("1"); x |= true; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x |= new String("1"); +if (x !== 1) { + throw new Test262Error('#7: x = new Boolean(true); x |= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x |= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#8: x = new String("1"); x |= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.6.js new file mode 100644 index 0000000000..13e91da781 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.6.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x |= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x |= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x |= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = undefined; x |= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x |= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x |= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x |= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = undefined; x |= new String("1"); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.7.js new file mode 100644 index 0000000000..cba6b8d9b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.7.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x |= null; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x |= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x |= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = null; x |= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x |= null; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x |= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x |= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = null; x |= new String("1"); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.8.js new file mode 100644 index 0000000000..b6c84f16f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x |= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = true; x |= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x |= true; +if (x !== 1) { + throw new Test262Error('#2: x = undefined; x |= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x |= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x |= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x |= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = undefined; x |= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.9.js new file mode 100644 index 0000000000..ed8fbf0deb --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x |= null; +if (x !== 1) { + throw new Test262Error('#1: x = true; x |= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x |= true; +if (x !== 1) { + throw new Test262Error('#2: x = null; x |= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x |= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x |= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x |= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = null; x |= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.1.js new file mode 100644 index 0000000000..f8575a4297 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x *= true; +if (x !== 1) { + throw new Test262Error('#1: x = true; x *= true; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x *= true; +if (x !== 1) { + throw new Test262Error('#2: x = new Boolean(true); x *= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x *= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#3: x = true; x *= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x *= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = new Boolean(true); x *= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.2.js new file mode 100644 index 0000000000..26581f39aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x *= 1; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x *= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x *= 1; +if (x !== 1) { + throw new Test262Error('#2: x = new Number(1); x *= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x *= new Number(1); +if (x !== 1) { + throw new Test262Error('#3: x = 1; x *= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x *= new Number(1); +if (x !== 1) { + throw new Test262Error('#4: x = new Number(1); x *= new Number(1); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.3.js new file mode 100644 index 0000000000..1d3b54a8a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x *= "1"; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x *= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x *= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = new String("1"); x *= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x *= new String("1"); +if (x !== 1) { + throw new Test262Error('#3: x = "1"; x *= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x *= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = new String("1"); x *= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = "x"; +x *= "1"; +if (isNaN(x) !== true) { + throw new Test262Error('#5: x = "x"; x *= "1"; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x *= "x"; +if (isNaN(x) !== true) { + throw new Test262Error('#6: x = "1"; x *= "x"; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.4.js new file mode 100644 index 0000000000..49231feef4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.4.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x *= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = null; x *= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x *= null; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x *= null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x *= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = undefined; x *= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x *= null; +if (x !== 0) { + throw new Test262Error('#4: x = null; x *= null; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.1.js new file mode 100644 index 0000000000..ca6aeabb32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Number (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x *= 1; +if (x !== 1) { + throw new Test262Error('#1: x = true; x *= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x *= true; +if (x !== 1) { + throw new Test262Error('#2: x = 1; x *= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x *= 1; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x *= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x *= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = 1; x *= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x *= new Number(1); +if (x !== 1) { + throw new Test262Error('#5: x = true; x *= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x *= true; +if (x !== 1) { + throw new Test262Error('#6: x = new Number(1); x *= true; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x *= new Number(1); +if (x !== 1) { + throw new Test262Error('#7: x = new Boolean(true); x *= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x *= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#8: x = new Number(1); x *= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.2.js new file mode 100644 index 0000000000..94e38b256f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.2.js @@ -0,0 +1,84 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x *= 1; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x *= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x *= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = 1; x *= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x *= 1; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x *= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x *= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = 1; x *= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x *= new Number(1); +if (x !== 1) { + throw new Test262Error('#5: x = "1"; x *= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x *= "1"; +if (x !== 1) { + throw new Test262Error('#6: x = new Number(1); x *= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x *= new Number(1); +if (x !== 1) { + throw new Test262Error('#7: x = new String("1"); x *= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x *= new String("1"); +if (x !== 1) { + throw new Test262Error('#8: x = new Number(1); x *= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#9 +x = "x"; +x *= 1; +if (isNaN(x) !== true) { + throw new Test262Error('#9: x = "x"; x *= 1; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x *= "x"; +if (isNaN(x) !== true) { + throw new Test262Error('#10: x = 1; x *= "x"; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.3.js new file mode 100644 index 0000000000..0e5dc94328 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x *= null; +if (x !== 0) { + throw new Test262Error('#1: x = 1; x *= null; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x *= 1; +if (x !== 0) { + throw new Test262Error('#2: x = null; x *= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x *= null; +if (x !== 0) { + throw new Test262Error('#3: x = new Number(1); x *= null; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x *= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = null; x *= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.4.js new file mode 100644 index 0000000000..0aa1ad0a91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x *= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = 1; x *= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x *= 1; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x *= 1; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x *= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Number(1); x *= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x *= new Number(1); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x *= new Number(1); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.5.js new file mode 100644 index 0000000000..e6b11a3471 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.5.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) amd Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x *= "1"; +if (x !== 1) { + throw new Test262Error('#1: x = true; x *= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x *= true; +if (x !== 1) { + throw new Test262Error('#2: x = "1"; x *= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x *= "1"; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x *= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x *= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = "1"; x *= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x *= new String("1"); +if (x !== 1) { + throw new Test262Error('#5: x = true; x *= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x *= true; +if (x !== 1) { + throw new Test262Error('#6: x = new String("1"); x *= true; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x *= new String("1"); +if (x !== 1) { + throw new Test262Error('#7: x = new Boolean(true); x *= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x *= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#8: x = new String("1"); x *= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.6.js new file mode 100644 index 0000000000..dc441c2cad --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.6.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + primitive String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x *= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = "1"; x *= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x *= "1"; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x *= "1"; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x *= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new String("1"); x *= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x *= new String("1"); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x *= new String("1"); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.7.js new file mode 100644 index 0000000000..0682be8cdd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.7.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x *= null; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x *= null; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x *= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = null; x *= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x *= null; +if (x !== 0) { + throw new Test262Error('#3: x = new String("1"); x *= null; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x *= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = null; x *= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.8.js new file mode 100644 index 0000000000..c4a95ef646 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x *= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = true; x *= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x *= true; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x *= true; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x *= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Boolean(true); x *= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x *= new Boolean(true); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x *= new Boolean(true); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.9.js new file mode 100644 index 0000000000..375ab3e845 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x *= null; +if (x !== 0) { + throw new Test262Error('#1: x = true; x *= null; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x *= true; +if (x !== 0) { + throw new Test262Error('#2: x = null; x *= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x *= null; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x *= null; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x *= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = null; x *= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.1.js new file mode 100644 index 0000000000..d0e608c6d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x /= true; +if (x !== 1) { + throw new Test262Error('#1: x = true; x /= true; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x /= true; +if (x !== 1) { + throw new Test262Error('#2: x = new Boolean(true); x /= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x /= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#3: x = true; x /= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x /= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = new Boolean(true); x /= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.2.js new file mode 100644 index 0000000000..08e431bce8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x /= 1; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x /= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x /= 1; +if (x !== 1) { + throw new Test262Error('#2: x = new Number(1); x /= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x /= new Number(1); +if (x !== 1) { + throw new Test262Error('#3: x = 1; x /= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x /= new Number(1); +if (x !== 1) { + throw new Test262Error('#4: x = new Number(1); x /= new Number(1); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.3.js new file mode 100644 index 0000000000..a29deb0f98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x /= "1"; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x /= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x /= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = new String("1"); x /= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x /= new String("1"); +if (x !== 1) { + throw new Test262Error('#3: x = "1"; x /= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x /= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = new String("1"); x /= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = "x"; +x /= "1"; +if (isNaN(x) !== true) { + throw new Test262Error('#5: x = "x"; x /= "1"; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x /= "x"; +if (isNaN(x) !== true) { + throw new Test262Error('#6: x = "1"; x /= "x"; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.4.js new file mode 100644 index 0000000000..4400d9da1f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.4.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x /= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = null; x /= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x /= null; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x /= null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x /= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = undefined; x /= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x /= null; +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = null; x /= null; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.1.js new file mode 100644 index 0000000000..d2bc042113 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x /= 1; +if (x !== 1) { + throw new Test262Error('#1: x = true; x /= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x /= true; +if (x !== 1) { + throw new Test262Error('#2: x = 1; x /= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x /= 1; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x /= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x /= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = 1; x /= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x /= new Number(1); +if (x !== 1) { + throw new Test262Error('#5: x = true; x /= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x /= true; +if (x !== 1) { + throw new Test262Error('#6: x = new Number(1); x /= true; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x /= new Number(1); +if (x !== 1) { + throw new Test262Error('#7: x = new Boolean(true); x /= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x /= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#8: x = new Number(1); x /= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.2.js new file mode 100644 index 0000000000..7bb8e87fd2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.2.js @@ -0,0 +1,84 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x /= 1; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x /= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x /= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = 1; x /= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x /= 1; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x /= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x /= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = 1; x /= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x /= new Number(1); +if (x !== 1) { + throw new Test262Error('#5: x = "1"; x /= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x /= "1"; +if (x !== 1) { + throw new Test262Error('#6: x = new Number(1); x /= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x /= new Number(1); +if (x !== 1) { + throw new Test262Error('#7: x = new String("1"); x /= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x /= new String("1"); +if (x !== 1) { + throw new Test262Error('#8: x = new Number(1); x /= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#9 +x = "x"; +x /= 1; +if (isNaN(x) !== true) { + throw new Test262Error('#9: x = "x"; x /= 1; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x /= "x"; +if (isNaN(x) !== true) { + throw new Test262Error('#10: x = 1; x /= "x"; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.3.js new file mode 100644 index 0000000000..eacda13613 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x /= null; +if (x !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: x = 1; x /= null; x === +Infinity. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x /= 1; +if (x !== 0) { + throw new Test262Error('#2: x = null; x /= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x /= null; +if (x !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3: x = new Number(1); x /= null; x === +Infinity. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x /= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = null; x /= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.4.js new file mode 100644 index 0000000000..6e22840446 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x /= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = 1; x /= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x /= 1; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x /= 1; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x /= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Number(1); x /= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x /= new Number(1); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x /= new Number(1); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.5.js new file mode 100644 index 0000000000..65fc8330d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.5.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x /= "1"; +if (x !== 1) { + throw new Test262Error('#1: x = true; x /= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x /= true; +if (x !== 1) { + throw new Test262Error('#2: x = "1"; x /= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x /= "1"; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x /= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x /= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = "1"; x /= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x /= new String("1"); +if (x !== 1) { + throw new Test262Error('#5: x = true; x /= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x /= true; +if (x !== 1) { + throw new Test262Error('#6: x = new String("1"); x /= true; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x /= new String("1"); +if (x !== 1) { + throw new Test262Error('#7: x = new Boolean(true); x /= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x /= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#8: x = new String("1"); x /= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.6.js new file mode 100644 index 0000000000..485b528988 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.6.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x /= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = "1"; x /= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x /= "1"; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x /= "1"; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x /= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new String("1"); x /= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x /= new String("1"); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x /= new String("1"); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.7.js new file mode 100644 index 0000000000..838ba70014 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.7.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x /= null; +if (x !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: x = "1"; x /= null; x === +Infinity. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x /= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = null; x /= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x /= null; +if (x !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3: x = new String("1"); x /= null; x === +Infinity. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x /= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = null; x /= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.8.js new file mode 100644 index 0000000000..83d73b6121 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x /= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = true; x /= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x /= true; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x /= true; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x /= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Boolean(true); x /= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x /= new Boolean(true); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x /= new Boolean(true); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.9.js new file mode 100644 index 0000000000..bffeca6706 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x /= null; +if (x !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: x = true; x /= null; x === +Infinity. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x /= true; +if (x !== 0) { + throw new Test262Error('#2: x = null; x /= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x /= null; +if (x !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3: x = new Boolean(true); x /= null; x === +Infinity. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x /= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = null; x /= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.1.js new file mode 100644 index 0000000000..7bd5c2a1ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x %= true; +if (x !== 0) { + throw new Test262Error('#1: x = true; x %= true; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x %= true; +if (x !== 0) { + throw new Test262Error('#2: x = new Boolean(true); x %= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x %= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#3: x = true; x %= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x %= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = new Boolean(true); x %= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.2.js new file mode 100644 index 0000000000..de0857fe40 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x %= 1; +if (x !== 0) { + throw new Test262Error('#1: x = 1; x %= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x %= 1; +if (x !== 0) { + throw new Test262Error('#2: x = new Number(1); x %= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x %= new Number(1); +if (x !== 0) { + throw new Test262Error('#3: x = 1; x %= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x %= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = new Number(1); x %= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.3.js new file mode 100644 index 0000000000..272b39a164 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x %= "1"; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x %= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x %= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = new String("1"); x %= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x %= new String("1"); +if (x !== 0) { + throw new Test262Error('#3: x = "1"; x %= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x %= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = new String("1"); x %= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = "x"; +x %= "1"; +if (isNaN(x) !== true) { + throw new Test262Error('#5: x = "x"; x %= "1"; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x %= "x"; +if (isNaN(x) !== true) { + throw new Test262Error('#6: x = "1"; x %= "x"; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.4.js new file mode 100644 index 0000000000..78f15cb2ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.4.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x %= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = null; x %= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x %= null; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x %= null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x %= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = undefined; x %= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x %= null; +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = null; x %= null; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.1.js new file mode 100644 index 0000000000..822e165567 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x %= 1; +if (x !== 0) { + throw new Test262Error('#1: x = true; x %= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x %= true; +if (x !== 0) { + throw new Test262Error('#2: x = 1; x %= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x %= 1; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x %= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x %= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = 1; x %= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x %= new Number(1); +if (x !== 0) { + throw new Test262Error('#5: x = true; x %= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x %= true; +if (x !== 0) { + throw new Test262Error('#6: x = new Number(1); x %= true; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x %= new Number(1); +if (x !== 0) { + throw new Test262Error('#7: x = new Boolean(true); x %= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x %= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#8: x = new Number(1); x %= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.2.js new file mode 100644 index 0000000000..76e9cbd5a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.2.js @@ -0,0 +1,84 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x %= 1; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x %= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x %= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = 1; x %= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x %= 1; +if (x !== 0) { + throw new Test262Error('#3: x = new String("1"); x %= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x %= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = 1; x %= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x %= new Number(1); +if (x !== 0) { + throw new Test262Error('#5: x = "1"; x %= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x %= "1"; +if (x !== 0) { + throw new Test262Error('#6: x = new Number(1); x %= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x %= new Number(1); +if (x !== 0) { + throw new Test262Error('#7: x = new String("1"); x %= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x %= new String("1"); +if (x !== 0) { + throw new Test262Error('#8: x = new Number(1); x %= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#9 +x = "x"; +x %= 1; +if (isNaN(x) !== true) { + throw new Test262Error('#9: x = "x"; x %= 1; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x %= "x"; +if (isNaN(x) !== true) { + throw new Test262Error('#10: x = 1; x %= "x"; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.3.js new file mode 100644 index 0000000000..85ca1c95dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x %= null; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = 1; x %= null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x %= 1; +if (x !== 0) { + throw new Test262Error('#2: x = null; x %= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x %= null; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Number(1); x %= null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x %= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = null; x %= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.4.js new file mode 100644 index 0000000000..342e4f9712 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x %= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = 1; x %= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x %= 1; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x %= 1; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x %= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Number(1); x %= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x %= new Number(1); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x %= new Number(1); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.5.js new file mode 100644 index 0000000000..254a579b00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.5.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x %= "1"; +if (x !== 0) { + throw new Test262Error('#1: x = true; x %= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x %= true; +if (x !== 0) { + throw new Test262Error('#2: x = "1"; x %= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x %= "1"; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x %= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x %= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = "1"; x %= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x %= new String("1"); +if (x !== 0) { + throw new Test262Error('#5: x = true; x %= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x %= true; +if (x !== 0) { + throw new Test262Error('#6: x = new String("1"); x %= true; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x %= new String("1"); +if (x !== 0) { + throw new Test262Error('#7: x = new Boolean(true); x %= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x %= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#8: x = new String("1"); x %= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.6.js new file mode 100644 index 0000000000..7fdb4d4b47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.6.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x %= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = "1"; x %= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x %= "1"; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x %= "1"; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x %= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new String("1"); x %= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x %= new String("1"); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x %= new String("1"); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.7.js new file mode 100644 index 0000000000..3aa454b330 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.7.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x %= null; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = "1"; x %= null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x %= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = null; x %= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x %= null; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new String("1"); x %= null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x %= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = null; x %= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.8.js new file mode 100644 index 0000000000..82eb2b4489 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x %= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = true; x %= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x %= true; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x %= true; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x %= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Boolean(true); x %= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x %= new Boolean(true); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x %= new Boolean(true); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.9.js new file mode 100644 index 0000000000..35db066b08 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x %= null; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = true; x %= null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x %= true; +if (x !== 0) { + throw new Test262Error('#2: x = null; x %= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x %= null; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Boolean(true); x %= null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x %= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = null; x %= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.1.js new file mode 100644 index 0000000000..def9e95ec1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x += true; +if (x !== 2) { + throw new Test262Error('#1: x = true; x += true; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x += true; +if (x !== 2) { + throw new Test262Error('#2: x = new Boolean(true); x += true; x === 2. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x += new Boolean(true); +if (x !== 2) { + throw new Test262Error('#3: x = true; x += new Boolean(true); x === 2. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x += new Boolean(true); +if (x !== 2) { + throw new Test262Error('#4: x = new Boolean(true); x += new Boolean(true); x === 2. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.2.js new file mode 100644 index 0000000000..6ca4000f7e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x += 1; +if (x !== 2) { + throw new Test262Error('#1: x = 1; x += 1; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x += 1; +if (x !== 2) { + throw new Test262Error('#2: x = new Number(1); x += 1; x === 2. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x += new Number(1); +if (x !== 2) { + throw new Test262Error('#3: x = 1; x += new Number(1); x === 2. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x += new Number(1); +if (x !== 2) { + throw new Test262Error('#4: x = new Number(1); x += new Number(1); x === 2. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.3.js new file mode 100644 index 0000000000..985c4e05d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T1.3 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x += undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = null; x += undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x += null; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x += null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x += undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = undefined; x += undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x += null; +if (x !== 0) { + throw new Test262Error('#4: x = null; x += null; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.4.js new file mode 100644 index 0000000000..fcbdccdb5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.4.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T1.4 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x += "1"; +if (x !== "11") { + throw new Test262Error('#1: x = "1"; x += "1"; x === "11". Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x += "1"; +if (x !== "11") { + throw new Test262Error('#2: x = new String("1"); x += "1"; x === "11". Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x += new String("1"); +if (x !== "11") { + throw new Test262Error('#3: x = "1"; x += new String("1"); x === "11". Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x += new String("1"); +if (x !== "11") { + throw new Test262Error('#4: x = new String("1"); x += new String("1"); x === "11". Actual: ' + (x)); +} + +//CHECK#5 +if ("x" + "1" !=="x1") { + throw new Test262Error('#5: x = "x"; x += "1"; x === "x1". Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x += "x"; +if (x !== "1x") { + throw new Test262Error('#6: x = "1"; x += "x"; x === "1x". Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.1.js new file mode 100644 index 0000000000..62ac5d69dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x += 1; +if (x !== 2) { + throw new Test262Error('#1: x = true; x += 1; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x += true; +if (x !== 2) { + throw new Test262Error('#2: x = 1; x += true; x === 2. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x += 1; +if (x !== 2) { + throw new Test262Error('#3: x = new Boolean(true); x += 1; x === 2. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x += new Boolean(true); +if (x !== 2) { + throw new Test262Error('#4: x = 1; x += new Boolean(true); x === 2. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x += new Number(1); +if (x !== 2) { + throw new Test262Error('#5: x = true; x += new Number(1); x === 2. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x += true; +if (x !== 2) { + throw new Test262Error('#6: x = new Number(1); x += true; x === 2. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x += new Number(1); +if (x !== 2) { + throw new Test262Error('#7: x = new Boolean(true); x += new Number(1); x === 2. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x += new Boolean(true); +if (x !== 2) { + throw new Test262Error('#8: x = new Number(1); x += new Boolean(true); x === 2. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.2.js new file mode 100644 index 0000000000..3c7e88f2ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.2.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x += null; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x += null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x += 1; +if (x !== 1) { + throw new Test262Error('#2: x = null; x += 1; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x += null; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x += null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x += new Number(1); +if (x !== 1) { + throw new Test262Error('#4: x = null; x += new Number(1); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.3.js new file mode 100644 index 0000000000..43820b63c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x += undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = 1; x += undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x += 1; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x += 1; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x += undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Number(1); x += undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x += new Number(1); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x += new Number(1); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.4.js new file mode 100644 index 0000000000..59f82c7814 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x += undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = true; x += undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x += true; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x += true; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x += undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Boolean(true); x += undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x += new Boolean(true); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x += new Boolean(true); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.5.js new file mode 100644 index 0000000000..8d192bb96a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.5.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x += null; +if (x !== 1) { + throw new Test262Error('#1: x = true; x += null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x += true; +if (x !== 1) { + throw new Test262Error('#2: x = null; x += true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x += null; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x += null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x += new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = null; x += new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.6.js new file mode 100644 index 0000000000..9262f90349 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.6.js @@ -0,0 +1,82 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x += 1; +if (x !== "11") { + throw new Test262Error('#1: x = "1"; x += 1; x === "11". Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x += "1"; +if (x !== "11") { + throw new Test262Error('#2: x = 1; x += "1"; x === "11". Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x += 1; +if (x !== "11") { + throw new Test262Error('#3: x = new String("1"); x += 1; x === "11". Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x += new String("1"); +if (x !== "11") { + throw new Test262Error('#4: x = 1; x += new String("1"); x === "11". Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x += new Number(1); +if (x !== "11") { + throw new Test262Error('#5: x = "1"; x += new Number(1); x === "11". Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x += "1"; +if (x !== "11") { + throw new Test262Error('#6: x = new Number(1); x += "1"; x === "11". Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x += new Number(1); +if (x !== "11") { + throw new Test262Error('#7: x = new String("1"); x += new Number(1); x === "11". Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x += new String("1"); +if (x !== "11") { + throw new Test262Error('#8: x = new Number(1); x += new String("1"); x === "11". Actual: ' + (x)); +} + +//CHECK#9 +if ("x" + 1 !=="x1") { + throw new Test262Error('#9: x = "x"; x += 1; x === "x1". Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x += "x"; +if (x !== "1x") { + throw new Test262Error('#10: x = 1; x += "x"; x === "1x". Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.7.js new file mode 100644 index 0000000000..7f6910bc82 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.7.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x += "1"; +if (x !== "true1") { + throw new Test262Error('#1: x = true; x += "1"; x === "true1". Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x += true; +if (x !== "1true") { + throw new Test262Error('#2: x = "1"; x += true; x === "1true". Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x += "1"; +if (x !== "true1") { + throw new Test262Error('#3: x = new Boolean(true); x += "1"; x === "true1". Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x += new Boolean(true); +if (x !== "1true") { + throw new Test262Error('#4: x = "1"; x += new Boolean(true); x === "1true". Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x += new String("1"); +if (x !== "true1") { + throw new Test262Error('#5: x = true; x += new String("1"); x === "true1". Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x += true; +if (x !== "1true") { + throw new Test262Error('#6: x = new String("1"); x += true; x === "1true". Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x += new String("1"); +if (x !== "true1") { + throw new Test262Error('#7: x = new Boolean(true); x += new String("1"); x === "true1". Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x += new Boolean(true); +if (x !== "1true") { + throw new Test262Error('#8: x = new String("1"); x += new Boolean(true); x === "1true". Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.8.js new file mode 100644 index 0000000000..4f7d89de42 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x += undefined; +if (x !== "1undefined") { + throw new Test262Error('#1: x = "1"; x += undefined; x === "1undefined". Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x += "1"; +if (x !== "undefined1") { + throw new Test262Error('#2: x = undefined; x += "1"; x === "undefined1". Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x += undefined; +if (x !== "1undefined") { + throw new Test262Error('#3: x = new String("1"); x += undefined; x === "1undefined". Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x += new String("1"); +if (x !== "undefined1") { + throw new Test262Error('#4: x = undefined; x += new String("1"); x === "undefined1". Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.9.js new file mode 100644 index 0000000000..639527314f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x += null; +if (x !== "1null") { + throw new Test262Error('#1: x = "1"; x += null; x === "1null". Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x += "1"; +if (x !== "null1") { + throw new Test262Error('#2: x = null; x += "1"; x === "null1". Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x += null; +if (x !== "1null") { + throw new Test262Error('#3: x = new String("1"); x += null; x === "1null". Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x += new String("1"); +if (x !== "null1") { + throw new Test262Error('#4: x = null; x += new String("1"); x === "null1". Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.1.js new file mode 100644 index 0000000000..ed0149dd80 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x -= true; +if (x !== 0) { + throw new Test262Error('#1: x = true; x -= true; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x -= true; +if (x !== 0) { + throw new Test262Error('#2: x = new Boolean(true); x -= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x -= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#3: x = true; x -= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x -= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = new Boolean(true); x -= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.2.js new file mode 100644 index 0000000000..61eacf24ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x -= 1; +if (x !== 0) { + throw new Test262Error('#1: x = 1; x -= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x -= 1; +if (x !== 0) { + throw new Test262Error('#2: x = new Number(1); x -= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x -= new Number(1); +if (x !== 0) { + throw new Test262Error('#3: x = 1; x -= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x -= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = new Number(1); x -= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.3.js new file mode 100644 index 0000000000..719695d9ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x -= "1"; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x -= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x -= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = new String("1"); x -= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x -= new String("1"); +if (x !== 0) { + throw new Test262Error('#3: x = "1"; x -= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x -= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = new String("1"); x -= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = "x"; +x -= "1"; +if (isNaN(x) !== true) { + throw new Test262Error('#5: x = "x"; x -= "1"; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x -= "x"; +if (isNaN(x) !== true) { + throw new Test262Error('#6: x = "1"; x -= "x"; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.4.js new file mode 100644 index 0000000000..b5d683c827 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.4.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x -= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = null; x -= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x -= null; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x -= null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x -= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = undefined; x -= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x -= null; +if (x !== 0) { + throw new Test262Error('#4: x = null; x -= null; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.1.js new file mode 100644 index 0000000000..677b2adb57 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x -= 1; +if (x !== 0) { + throw new Test262Error('#1: x = true; x -= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x -= true; +if (x !== 0) { + throw new Test262Error('#2: x = 1; x -= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x -= 1; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x -= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x -= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = 1; x -= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x -= new Number(1); +if (x !== 0) { + throw new Test262Error('#5: x = true; x -= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x -= true; +if (x !== 0) { + throw new Test262Error('#6: x = new Number(1); x -= true; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x -= new Number(1); +if (x !== 0) { + throw new Test262Error('#7: x = new Boolean(true); x -= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x -= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#8: x = new Number(1); x -= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.2.js new file mode 100644 index 0000000000..55cbe1d128 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.2.js @@ -0,0 +1,84 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x -= 1; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x -= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x -= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = 1; x -= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x -= 1; +if (x !== 0) { + throw new Test262Error('#3: x = new String("1"); x -= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x -= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = 1; x -= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x -= new Number(1); +if (x !== 0) { + throw new Test262Error('#5: x = "1"; x -= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x -= "1"; +if (x !== 0) { + throw new Test262Error('#6: x = new Number(1); x -= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x -= new Number(1); +if (x !== 0) { + throw new Test262Error('#7: x = new String("1"); x -= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x -= new String("1"); +if (x !== 0) { + throw new Test262Error('#8: x = new Number(1); x -= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#9 +x = "x"; +x -= 1; +if (isNaN(x) !== true) { + throw new Test262Error('#9: x = "x"; x -= 1; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x -= "x"; +if (isNaN(x) !== true) { + throw new Test262Error('#10: x = 1; x -= "x"; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.3.js new file mode 100644 index 0000000000..96eaea4146 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x -= null; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x -= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x -= 1; +if (x !== -1) { + throw new Test262Error('#2: x = null; x -= 1; x === -1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x -= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x -= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x -= new Number(1); +if (x !== -1) { + throw new Test262Error('#4: x = null; x -= new Number(1); x === -1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.4.js new file mode 100644 index 0000000000..3a206858ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x -= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = 1; x -= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x -= 1; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x -= 1; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x -= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Number(1); x -= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x -= new Number(1); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x -= new Number(1); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.5.js new file mode 100644 index 0000000000..463f5ed417 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.5.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x -= "1"; +if (x !== 0) { + throw new Test262Error('#1: x = true; x -= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x -= true; +if (x !== 0) { + throw new Test262Error('#2: x = "1"; x -= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x -= "1"; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x -= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x -= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = "1"; x -= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x -= new String("1"); +if (x !== 0) { + throw new Test262Error('#5: x = true; x -= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x -= true; +if (x !== 0) { + throw new Test262Error('#6: x = new String("1"); x -= true; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x -= new String("1"); +if (x !== 0) { + throw new Test262Error('#7: x = new Boolean(true); x -= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x -= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#8: x = new String("1"); x -= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.6.js new file mode 100644 index 0000000000..7b4d2150af --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.6.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x -= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = "1"; x -= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x -= "1"; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x -= "1"; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x -= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new String("1"); x -= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x -= new String("1"); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x -= new String("1"); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.7.js new file mode 100644 index 0000000000..5c3cda3495 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.7.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x -= null; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x -= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x -= "1"; +if (x !== -1) { + throw new Test262Error('#2: x = null; x -= "1"; x === -1. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x -= null; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x -= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x -= new String("1"); +if (x !== -1) { + throw new Test262Error('#4: x = null; x -= new String("1"); x === -1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.8.js new file mode 100644 index 0000000000..b5294039d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x -= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = true; x -= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x -= true; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x -= true; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x -= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Boolean(true); x -= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x -= new Boolean(true); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x -= new Boolean(true); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.9.js new file mode 100644 index 0000000000..1d3e75c723 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x -= null; +if (x !== 1) { + throw new Test262Error('#1: x = true; x -= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x -= true; +if (x !== -1) { + throw new Test262Error('#2: x = null; x -= true; x === -1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x -= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x -= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x -= new Boolean(true); +if (x !== -1) { + throw new Test262Error('#4: x = null; x -= new Boolean(true); x === -1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.1.js new file mode 100644 index 0000000000..4558b9c05e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x <<= true; +if (x !== 2) { + throw new Test262Error('#1: x = true; x <<= true; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x <<= true; +if (x !== 2) { + throw new Test262Error('#2: x = new Boolean(true); x <<= true; x === 2. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x <<= new Boolean(true); +if (x !== 2) { + throw new Test262Error('#3: x = true; x <<= new Boolean(true); x === 2. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x <<= new Boolean(true); +if (x !== 2) { + throw new Test262Error('#4: x = new Boolean(true); x <<= new Boolean(true); x === 2. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.2.js new file mode 100644 index 0000000000..224ac0392b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x <<= 1; +if (x !== 2) { + throw new Test262Error('#1: x = 1; x <<= 1; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x <<= 1; +if (x !== 2) { + throw new Test262Error('#2: x = new Number(1); x <<= 1; x === 2. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x <<= new Number(1); +if (x !== 2) { + throw new Test262Error('#3: x = 1; x <<= new Number(1); x === 2. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x <<= new Number(1); +if (x !== 2) { + throw new Test262Error('#4: x = new Number(1); x <<= new Number(1); x === 2. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.3.js new file mode 100644 index 0000000000..a1dd211c33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x <<= "1"; +if (x !== 2) { + throw new Test262Error('#1: x = "1"; x <<= "1"; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x <<= "1"; +if (x !== 2) { + throw new Test262Error('#2: x = new String("1"); x <<= "1"; x === 2. Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x <<= new String("1"); +if (x !== 2) { + throw new Test262Error('#3: x = "1"; x <<= new String("1"); x === 2. Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x <<= new String("1"); +if (x !== 2) { + throw new Test262Error('#4: x = new String("1"); x <<= new String("1"); x === 2. Actual: ' + (x)); +} + +//CHECK#5 +x = "x"; +x <<= "1"; +if (x !== 0) { + throw new Test262Error('#5: x = "x"; x <<= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x <<= "x"; +if (x !== 1) { + throw new Test262Error('#6: x = "1"; x <<= "x"; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.4.js new file mode 100644 index 0000000000..4289785f6a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.4.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x <<= undefined; +if (x !== 0) { + throw new Test262Error('#1: x = null; x <<= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x <<= null; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x <<= null; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x <<= undefined; +if (x !== 0) { + throw new Test262Error('#3: x = undefined; x <<= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x <<= null; +if (x !== 0) { + throw new Test262Error('#4: x = null; x <<= null; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.1.js new file mode 100644 index 0000000000..7bda109d85 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x <<= 1; +if (x !== 2) { + throw new Test262Error('#1: x = true; x <<= 1; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x <<= true; +if (x !== 2) { + throw new Test262Error('#2: x = 1; x <<= true; x === 2. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x <<= 1; +if (x !== 2) { + throw new Test262Error('#3: x = new Boolean(true); x <<= 1; x === 2. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x <<= new Boolean(true); +if (x !== 2) { + throw new Test262Error('#4: x = 1; x <<= new Boolean(true); x === 2. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x <<= new Number(1); +if (x !== 2) { + throw new Test262Error('#5: x = true; x <<= new Number(1); x === 2. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x <<= true; +if (x !== 2) { + throw new Test262Error('#6: x = new Number(1); x <<= true; x === 2. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x <<= new Number(1); +if (x !== 2) { + throw new Test262Error('#7: x = new Boolean(true); x <<= new Number(1); x === 2. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x <<= new Boolean(true); +if (x !== 2) { + throw new Test262Error('#8: x = new Number(1); x <<= new Boolean(true); x === 2. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.2.js new file mode 100644 index 0000000000..3dd1687ced --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.2.js @@ -0,0 +1,84 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x <<= 1; +if (x !== 2) { + throw new Test262Error('#1: x = "1"; x <<= 1; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x <<= "1"; +if (x !== 2) { + throw new Test262Error('#2: x = 1; x <<= "1"; x === 2. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x <<= 1; +if (x !== 2) { + throw new Test262Error('#3: x = new String("1"); x <<= 1; x === 2. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x <<= new String("1"); +if (x !== 2) { + throw new Test262Error('#4: x = 1; x <<= new String("1"); x === 2. Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x <<= new Number(1); +if (x !== 2) { + throw new Test262Error('#5: x = "1"; x <<= new Number(1); x === 2. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x <<= "1"; +if (x !== 2) { + throw new Test262Error('#6: x = new Number(1); x <<= "1"; x === 2. Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x <<= new Number(1); +if (x !== 2) { + throw new Test262Error('#7: x = new String("1"); x <<= new Number(1); x === 2. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x <<= new String("1"); +if (x !== 2) { + throw new Test262Error('#8: x = new Number(1); x <<= new String("1"); x === 2. Actual: ' + (x)); +} + +//CHECK#9 +x = "x"; +x <<= 1; +if (x !== 0) { + throw new Test262Error('#9: x = "x"; x <<= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x <<= "x"; +if (x !== 1) { + throw new Test262Error('#10: x = 1; x <<= "x"; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.3.js new file mode 100644 index 0000000000..0534254c01 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x <<= null; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x <<= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x <<= 1; +if (x !== 0) { + throw new Test262Error('#2: x = null; x <<= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x <<= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x <<= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x <<= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = null; x <<= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.4.js new file mode 100644 index 0000000000..f8c43acf4a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x <<= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x <<= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x <<= 1; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x <<= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x <<= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x <<= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x <<= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x <<= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.5.js new file mode 100644 index 0000000000..822955fa07 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.5.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x <<= "1"; +if (x !== 2) { + throw new Test262Error('#1: x = true; x <<= "1"; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x <<= true; +if (x !== 2) { + throw new Test262Error('#2: x = "1"; x <<= true; x === 2. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x <<= "1"; +if (x !== 2) { + throw new Test262Error('#3: x = new Boolean(true); x <<= "1"; x === 2. Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x <<= new Boolean(true); +if (x !== 2) { + throw new Test262Error('#4: x = "1"; x <<= new Boolean(true); x === 2. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x <<= new String("1"); +if (x !== 2) { + throw new Test262Error('#5: x = true; x <<= new String("1"); x === 2. Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x <<= true; +if (x !== 2) { + throw new Test262Error('#6: x = new String("1"); x <<= true; x === 2. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x <<= new String("1"); +if (x !== 2) { + throw new Test262Error('#7: x = new Boolean(true); x <<= new String("1"); x === 2. Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x <<= new Boolean(true); +if (x !== 2) { + throw new Test262Error('#8: x = new String("1"); x <<= new Boolean(true); x === 2. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.6.js new file mode 100644 index 0000000000..2ecf4e2778 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.6.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x <<= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x <<= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x <<= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x <<= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x <<= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x <<= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x <<= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x <<= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.7.js new file mode 100644 index 0000000000..f2f834c04c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.7.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x <<= null; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x <<= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x <<= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = null; x <<= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x <<= null; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x <<= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x <<= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = null; x <<= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.8.js new file mode 100644 index 0000000000..bd1eedac29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x <<= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = true; x <<= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x <<= true; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x <<= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x <<= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x <<= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x <<= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x <<= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.9.js new file mode 100644 index 0000000000..9dedd45cfd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x <<= null; +if (x !== 1) { + throw new Test262Error('#1: x = true; x <<= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x <<= true; +if (x !== 0) { + throw new Test262Error('#2: x = null; x <<= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x <<= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x <<= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x <<= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = null; x <<= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.1.js new file mode 100644 index 0000000000..4e2534c00e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x >>= true; +if (x !== 0) { + throw new Test262Error('#1: x = true; x >>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x >>= true; +if (x !== 0) { + throw new Test262Error('#2: x = new Boolean(true); x >>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x >>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#3: x = true; x >>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x >>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = new Boolean(true); x >>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.2.js new file mode 100644 index 0000000000..e04ddfcda0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x >>= 1; +if (x !== 0) { + throw new Test262Error('#1: x = 1; x >>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x >>= 1; +if (x !== 0) { + throw new Test262Error('#2: x = new Number(1); x >>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x >>= new Number(1); +if (x !== 0) { + throw new Test262Error('#3: x = 1; x >>= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x >>= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = new Number(1); x >>= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.3.js new file mode 100644 index 0000000000..fdca6c1f7a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x >>= "1"; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x >>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x >>= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = new String("1"); x >>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x >>= new String("1"); +if (x !== 0) { + throw new Test262Error('#3: x = "1"; x >>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x >>= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = new String("1"); x >>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = "x"; +x >>= "1"; +if (x !== 0) { + throw new Test262Error('#5: x = "x"; x >>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x >>= "x"; +if (x !== 1) { + throw new Test262Error('#6: x = "1"; x >>= "x"; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.4.js new file mode 100644 index 0000000000..d8e9bf8230 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.4.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x >>= undefined; +if (x !== 0) { + throw new Test262Error('#1: x = null; x >>= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x >>= null; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x >>= null; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x >>= undefined; +if (x !== 0) { + throw new Test262Error('#3: x = undefined; x >>= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x >>= null; +if (x !== 0) { + throw new Test262Error('#4: x = null; x >>= null; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.1.js new file mode 100644 index 0000000000..b117dc0d8c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x >>= 1; +if (x !== 0) { + throw new Test262Error('#1: x = true; x >>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x >>= true; +if (x !== 0) { + throw new Test262Error('#2: x = 1; x >>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x >>= 1; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x >>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x >>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = 1; x >>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x >>= new Number(1); +if (x !== 0) { + throw new Test262Error('#5: x = true; x >>= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x >>= true; +if (x !== 0) { + throw new Test262Error('#6: x = new Number(1); x >>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x >>= new Number(1); +if (x !== 0) { + throw new Test262Error('#7: x = new Boolean(true); x >>= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x >>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#8: x = new Number(1); x >>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.2.js new file mode 100644 index 0000000000..5a80e627e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.2.js @@ -0,0 +1,84 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x >>= 1; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x >>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x >>= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = 1; x >>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x >>= 1; +if (x !== 0) { + throw new Test262Error('#3: x = new String("1"); x >>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x >>= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = 1; x >>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x >>= new Number(1); +if (x !== 0) { + throw new Test262Error('#5: x = "1"; x >>= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x >>= "1"; +if (x !== 0) { + throw new Test262Error('#6: x = new Number(1); x >>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x >>= new Number(1); +if (x !== 0) { + throw new Test262Error('#7: x = new String("1"); x >>= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x >>= new String("1"); +if (x !== 0) { + throw new Test262Error('#8: x = new Number(1); x >>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#9 +x = "x"; +x >>= 1; +if (x !== 0) { + throw new Test262Error('#9: x = "x"; x >>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x >>= "x"; +if (x !== 1) { + throw new Test262Error('#10: x = 1; x >>= "x"; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.3.js new file mode 100644 index 0000000000..8d8f1abd89 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x >>= null; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x >>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x >>= 1; +if (x !== 0) { + throw new Test262Error('#2: x = null; x >>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x >>= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x >>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x >>= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = null; x >>= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.4.js new file mode 100644 index 0000000000..d501ff9063 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x >>= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x >>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x >>= 1; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x >>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x >>= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x >>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x >>= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x >>= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.5.js new file mode 100644 index 0000000000..a520ed896a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.5.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x >>= "1"; +if (x !== 0) { + throw new Test262Error('#1: x = true; x >>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x >>= true; +if (x !== 0) { + throw new Test262Error('#2: x = "1"; x >>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x >>= "1"; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x >>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x >>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = "1"; x >>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x >>= new String("1"); +if (x !== 0) { + throw new Test262Error('#5: x = true; x >>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x >>= true; +if (x !== 0) { + throw new Test262Error('#6: x = new String("1"); x >>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x >>= new String("1"); +if (x !== 0) { + throw new Test262Error('#7: x = new Boolean(true); x >>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x >>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#8: x = new String("1"); x >>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.6.js new file mode 100644 index 0000000000..a482690907 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.6.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x >>= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x >>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x >>= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x >>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x >>= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x >>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x >>= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x >>= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.7.js new file mode 100644 index 0000000000..53f7e3f1eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.7.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x >>= null; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x >>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x >>= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = null; x >>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x >>= null; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x >>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x >>= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = null; x >>= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.8.js new file mode 100644 index 0000000000..35d00528c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x >>= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = true; x >>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x >>= true; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x >>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x >>= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x >>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x >>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x >>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.9.js new file mode 100644 index 0000000000..4c6216226b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x >>= null; +if (x !== 1) { + throw new Test262Error('#1: x = true; x >>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x >>= true; +if (x !== 0) { + throw new Test262Error('#2: x = null; x >>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x >>= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x >>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x >>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = null; x >>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.1.js new file mode 100644 index 0000000000..cfeb7a1d87 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x >>>= true; +if (x !== 0) { + throw new Test262Error('#1: x = true; x >>>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x >>>= true; +if (x !== 0) { + throw new Test262Error('#2: x = new Boolean(true); x >>>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x >>>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#3: x = true; x >>>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x >>>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = new Boolean(true); x >>>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.2.js new file mode 100644 index 0000000000..7f6201ddd6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x >>>= 1; +if (x !== 0) { + throw new Test262Error('#1: x = 1; x >>>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x >>>= 1; +if (x !== 0) { + throw new Test262Error('#2: x = new Number(1); x >>>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x >>>= new Number(1); +if (x !== 0) { + throw new Test262Error('#3: x = 1; x >>>= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x >>>= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = new Number(1); x >>>= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.3.js new file mode 100644 index 0000000000..0904e92645 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x >>>= "1"; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x >>>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x >>>= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = new String("1"); x >>>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x >>>= new String("1"); +if (x !== 0) { + throw new Test262Error('#3: x = "1"; x >>>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x >>>= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = new String("1"); x >>>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = "x"; +x >>>= "1"; +if (x !== 0) { + throw new Test262Error('#5: x = "x"; x >>>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x >>>= "x"; +if (x !== 1) { + throw new Test262Error('#6: x = "1"; x >>>= "x"; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.4.js new file mode 100644 index 0000000000..da04b34049 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.4.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x >>>= undefined; +if (x !== 0) { + throw new Test262Error('#1: x = null; x >>>= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x >>>= null; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x >>>= null; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x >>>= undefined; +if (x !== 0) { + throw new Test262Error('#3: x = undefined; x >>>= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x >>>= null; +if (x !== 0) { + throw new Test262Error('#4: x = null; x >>>= null; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.1.js new file mode 100644 index 0000000000..d03b390225 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x >>>= 1; +if (x !== 0) { + throw new Test262Error('#1: x = true; x >>>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x >>>= true; +if (x !== 0) { + throw new Test262Error('#2: x = 1; x >>>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x >>>= 1; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x >>>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x >>>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = 1; x >>>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x >>>= new Number(1); +if (x !== 0) { + throw new Test262Error('#5: x = true; x >>>= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x >>>= true; +if (x !== 0) { + throw new Test262Error('#6: x = new Number(1); x >>>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x >>>= new Number(1); +if (x !== 0) { + throw new Test262Error('#7: x = new Boolean(true); x >>>= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x >>>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#8: x = new Number(1); x >>>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.2.js new file mode 100644 index 0000000000..1d099a158e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.2.js @@ -0,0 +1,84 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x >>>= 1; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x >>>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x >>>= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = 1; x >>>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x >>>= 1; +if (x !== 0) { + throw new Test262Error('#3: x = new String("1"); x >>>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x >>>= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = 1; x >>>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x >>>= new Number(1); +if (x !== 0) { + throw new Test262Error('#5: x = "1"; x >>>= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x >>>= "1"; +if (x !== 0) { + throw new Test262Error('#6: x = new Number(1); x >>>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x >>>= new Number(1); +if (x !== 0) { + throw new Test262Error('#7: x = new String("1"); x >>>= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x >>>= new String("1"); +if (x !== 0) { + throw new Test262Error('#8: x = new Number(1); x >>>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#9 +x = "x"; +x >>>= 1; +if (x !== 0) { + throw new Test262Error('#9: x = "x"; x >>>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x >>>= "x"; +if (x !== 1) { + throw new Test262Error('#10: x = 1; x >>>= "x"; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.3.js new file mode 100644 index 0000000000..c0762d70ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x >>>= null; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x >>>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x >>>= 1; +if (x !== 0) { + throw new Test262Error('#2: x = null; x >>>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x >>>= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x >>>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x >>>= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = null; x >>>= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.4.js new file mode 100644 index 0000000000..3281c8c605 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x >>>= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x >>>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x >>>= 1; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x >>>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x >>>= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x >>>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x >>>= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x >>>= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.5.js new file mode 100644 index 0000000000..bade1ef9f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.5.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x >>>= "1"; +if (x !== 0) { + throw new Test262Error('#1: x = true; x >>>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x >>>= true; +if (x !== 0) { + throw new Test262Error('#2: x = "1"; x >>>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x >>>= "1"; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x >>>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x >>>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = "1"; x >>>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x >>>= new String("1"); +if (x !== 0) { + throw new Test262Error('#5: x = true; x >>>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x >>>= true; +if (x !== 0) { + throw new Test262Error('#6: x = new String("1"); x >>>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x >>>= new String("1"); +if (x !== 0) { + throw new Test262Error('#7: x = new Boolean(true); x >>>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x >>>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#8: x = new String("1"); x >>>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.6.js new file mode 100644 index 0000000000..94ec28e55a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.6.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x >>>= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x >>>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x >>>= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x >>>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x >>>= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x >>>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x >>>= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x >>>= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.7.js new file mode 100644 index 0000000000..d942f683c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.7.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x >>>= null; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x >>>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x >>>= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = null; x >>>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x >>>= null; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x >>>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x >>>= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = null; x >>>= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.8.js new file mode 100644 index 0000000000..eb448b52b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x >>>= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = true; x >>>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x >>>= true; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x >>>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x >>>= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x >>>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x >>>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x >>>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.9.js new file mode 100644 index 0000000000..7a3b5a1d55 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x >>>= null; +if (x !== 1) { + throw new Test262Error('#1: x = true; x >>>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x >>>= true; +if (x !== 0) { + throw new Test262Error('#2: x = null; x >>>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x >>>= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x >>>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x >>>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = null; x >>>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.1.js new file mode 100644 index 0000000000..a59158aca2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x &= true; +if (x !== 1) { + throw new Test262Error('#1: x = true; x &= true; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x &= true; +if (x !== 1) { + throw new Test262Error('#2: x = new Boolean(true); x &= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x &= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#3: x = true; x &= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x &= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = new Boolean(true); x &= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.2.js new file mode 100644 index 0000000000..aac470947e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x &= 1; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x &= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x &= 1; +if (x !== 1) { + throw new Test262Error('#2: x = new Number(1); x &= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x &= new Number(1); +if (x !== 1) { + throw new Test262Error('#3: x = 1; x &= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x &= new Number(1); +if (x !== 1) { + throw new Test262Error('#4: x = new Number(1); x &= new Number(1); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.3.js new file mode 100644 index 0000000000..cc7360b8ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x &= "1"; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x &= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x &= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = new String("1"); x &= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x &= new String("1"); +if (x !== 1) { + throw new Test262Error('#3: x = "1"; x &= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x &= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = new String("1"); x &= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = "x"; +x &= "1"; +if (x !== 0) { + throw new Test262Error('#5: x = "x"; x &= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x &= "x"; +if (x !== 0) { + throw new Test262Error('#6: x = "1"; x &= "x"; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.4.js new file mode 100644 index 0000000000..c3eda9ebcb --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.4.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x &= undefined; +if (x !== 0) { + throw new Test262Error('#1: x = null; x &= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x &= null; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x &= null; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x &= undefined; +if (x !== 0) { + throw new Test262Error('#3: x = undefined; x &= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x &= null; +if (x !== 0) { + throw new Test262Error('#4: x = null; x &= null; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.1.js new file mode 100644 index 0000000000..e685aeba7e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x &= 1; +if (x !== 1) { + throw new Test262Error('#1: x = true; x &= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x &= true; +if (x !== 1) { + throw new Test262Error('#2: x = 1; x &= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x &= 1; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x &= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x &= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = 1; x &= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x &= new Number(1); +if (x !== 1) { + throw new Test262Error('#5: x = true; x &= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x &= true; +if (x !== 1) { + throw new Test262Error('#6: x = new Number(1); x &= true; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x &= new Number(1); +if (x !== 1) { + throw new Test262Error('#7: x = new Boolean(true); x &= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x &= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#8: x = new Number(1); x &= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.2.js new file mode 100644 index 0000000000..ae2aad2a94 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.2.js @@ -0,0 +1,84 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x &= 1; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x &= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x &= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = 1; x &= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x &= 1; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x &= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x &= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = 1; x &= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x &= new Number(1); +if (x !== 1) { + throw new Test262Error('#5: x = "1"; x &= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x &= "1"; +if (x !== 1) { + throw new Test262Error('#6: x = new Number(1); x &= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x &= new Number(1); +if (x !== 1) { + throw new Test262Error('#7: x = new String("1"); x &= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x &= new String("1"); +if (x !== 1) { + throw new Test262Error('#8: x = new Number(1); x &= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#9 +x = "x"; +x &= 1; +if (x !== 0) { + throw new Test262Error('#9: x = "x"; x &= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x &= "x"; +if (x !== 0) { + throw new Test262Error('#10: x = 1; x &= "x"; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.3.js new file mode 100644 index 0000000000..f7c993447e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x &= null; +if (x !== 0) { + throw new Test262Error('#1: x = 1; x &= null; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x &= 1; +if (x !== 0) { + throw new Test262Error('#2: x = null; x &= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x &= null; +if (x !== 0) { + throw new Test262Error('#3: x = new Number(1); x &= null; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x &= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = null; x &= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.4.js new file mode 100644 index 0000000000..e860aad6b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x &= undefined; +if (x !== 0) { + throw new Test262Error('#1: x = 1; x &= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x &= 1; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x &= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x &= undefined; +if (x !== 0) { + throw new Test262Error('#3: x = new Number(1); x &= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x &= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x &= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.5.js new file mode 100644 index 0000000000..6088e77af8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.5.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x &= "1"; +if (x !== 1) { + throw new Test262Error('#1: x = true; x &= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x &= true; +if (x !== 1) { + throw new Test262Error('#2: x = "1"; x &= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x &= "1"; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x &= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x &= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = "1"; x &= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x &= new String("1"); +if (x !== 1) { + throw new Test262Error('#5: x = true; x &= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x &= true; +if (x !== 1) { + throw new Test262Error('#6: x = new String("1"); x &= true; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x &= new String("1"); +if (x !== 1) { + throw new Test262Error('#7: x = new Boolean(true); x &= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x &= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#8: x = new String("1"); x &= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.6.js new file mode 100644 index 0000000000..06bbd59949 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.6.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x &= undefined; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x &= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x &= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x &= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x &= undefined; +if (x !== 0) { + throw new Test262Error('#3: x = new String("1"); x &= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x &= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x &= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.7.js new file mode 100644 index 0000000000..6143f0a96a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.7.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x &= null; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x &= null; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x &= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = null; x &= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x &= null; +if (x !== 0) { + throw new Test262Error('#3: x = new String("1"); x &= null; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x &= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = null; x &= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.8.js new file mode 100644 index 0000000000..248a32ea25 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x &= undefined; +if (x !== 0) { + throw new Test262Error('#1: x = true; x &= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x &= true; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x &= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x &= undefined; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x &= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x &= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x &= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.9.js new file mode 100644 index 0000000000..27fda32bf9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x &= null; +if (x !== 0) { + throw new Test262Error('#1: x = true; x &= null; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x &= true; +if (x !== 0) { + throw new Test262Error('#2: x = null; x &= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x &= null; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x &= null; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x &= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = null; x &= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T1.js new file mode 100644 index 0000000000..daf140bc53 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.10_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x ^= y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 2; + } + }; + + with (scope) { + x ^= 3; + } + + if (scope.x !== 1) { + throw new Test262Error('#1: scope.x === 1. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T2.js new file mode 100644 index 0000000000..c502af641a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.10_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x ^= y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + x ^= 3; +} + +if (scope.x !== 1) { + throw new Test262Error('#1: scope.x === 1. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T3.js new file mode 100644 index 0000000000..ea37861ec8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.10_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x ^= y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 2; + } +}; + +with (outerScope) { + with (innerScope) { + x ^= 3; + } +} + +if (innerScope.x !== 1) { + throw new Test262Error('#1: innerScope.x === 1. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T1.js new file mode 100644 index 0000000000..6df8dc7cfb --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.11_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x |= y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 2; + } + }; + + with (scope) { + x |= 4; + } + + if (scope.x !== 6) { + throw new Test262Error('#1: scope.x === 6. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T2.js new file mode 100644 index 0000000000..3849dea273 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.11_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x |= y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + x |= 4; +} + +if (scope.x !== 6) { + throw new Test262Error('#1: scope.x === 6. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T3.js new file mode 100644 index 0000000000..419d8daf9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.11_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x |= y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 2; + } +}; + +with (outerScope) { + with (innerScope) { + x |= 4; + } +} + +if (innerScope.x !== 6) { + throw new Test262Error('#1: innerScope.x === 6. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T1.js new file mode 100644 index 0000000000..190a1e2635 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.1_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x *= y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 2; + } + }; + + with (scope) { + x *= 3; + } + + if (scope.x !== 6) { + throw new Test262Error('#1: scope.x === 6. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T2.js new file mode 100644 index 0000000000..75749802a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.1_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x *= y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + x *= 3; +} + +if (scope.x !== 6) { + throw new Test262Error('#1: scope.x === 6. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T3.js new file mode 100644 index 0000000000..62d97a5bf0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.1_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x *= y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 2; + } +}; + +with (outerScope) { + with (innerScope) { + x *= 3; + } +} + +if (innerScope.x !== 6) { + throw new Test262Error('#1: innerScope.x === 6. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T1.js new file mode 100644 index 0000000000..f3998fdadd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.2_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x /= y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 6; + } + }; + + with (scope) { + x /= 3; + } + + if (scope.x !== 2) { + throw new Test262Error('#1: scope.x === 2. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T2.js new file mode 100644 index 0000000000..96997c6b06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.2_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x /= y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 6; + } +}; + +with (scope) { + x /= 3; +} + +if (scope.x !== 2) { + throw new Test262Error('#1: scope.x === 2. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T3.js new file mode 100644 index 0000000000..350bbe7acc --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.2_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x /= y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 6; + } +}; + +with (outerScope) { + with (innerScope) { + x /= 3; + } +} + +if (innerScope.x !== 2) { + throw new Test262Error('#1: innerScope.x === 2. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T1.js new file mode 100644 index 0000000000..40ed4cf9b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.3_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x %= y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 5; + } + }; + + with (scope) { + x %= 3; + } + + if (scope.x !== 2) { + throw new Test262Error('#1: scope.x === 2. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T2.js new file mode 100644 index 0000000000..69784760c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.3_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x %= y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 5; + } +}; + +with (scope) { + x %= 3; +} + +if (scope.x !== 2) { + throw new Test262Error('#1: scope.x === 2. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T3.js new file mode 100644 index 0000000000..1447c6170e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.3_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x %= y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 5; + } +}; + +with (outerScope) { + with (innerScope) { + x %= 3; + } +} + +if (innerScope.x !== 2) { + throw new Test262Error('#1: innerScope.x === 2. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T1.js new file mode 100644 index 0000000000..0e612dd794 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.4_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x += y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 2; + } + }; + + with (scope) { + x += 1; + } + + if (scope.x !== 3) { + throw new Test262Error('#1: scope.x === 3. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T2.js new file mode 100644 index 0000000000..caf85f5752 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.4_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x += y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + x += 1; +} + +if (scope.x !== 3) { + throw new Test262Error('#1: scope.x === 3. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T3.js new file mode 100644 index 0000000000..b7d76bf280 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.4_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x += y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 2; + } +}; + +with (outerScope) { + with (innerScope) { + x += 1; + } +} + +if (innerScope.x !== 3) { + throw new Test262Error('#1: innerScope.x === 3. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T1.js new file mode 100644 index 0000000000..1b932c6532 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.5_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x -= y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 2; + } + }; + + with (scope) { + x -= 1; + } + + if (scope.x !== 1) { + throw new Test262Error('#1: scope.x === 1. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T2.js new file mode 100644 index 0000000000..53ff618dca --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.5_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x -= y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + x -= 1; +} + +if (scope.x !== 1) { + throw new Test262Error('#1: scope.x === 1. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T3.js new file mode 100644 index 0000000000..b152ad1d8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.5_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x -= y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 2; + } +}; + +with (outerScope) { + with (innerScope) { + x -= 1; + } +} + +if (innerScope.x !== 1) { + throw new Test262Error('#1: innerScope.x === 1. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T1.js new file mode 100644 index 0000000000..4d1009a50b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.6_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x <<= y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 2; + } + }; + + with (scope) { + x <<= 3; + } + + if (scope.x !== 16) { + throw new Test262Error('#1: scope.x === 16. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T2.js new file mode 100644 index 0000000000..9589ad500e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.6_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x <<= y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + x <<= 3; +} + +if (scope.x !== 16) { + throw new Test262Error('#1: scope.x === 16. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T3.js new file mode 100644 index 0000000000..38f50694c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.6_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x <<= y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 2; + } +}; + +with (outerScope) { + with (innerScope) { + x <<= 3; + } +} + +if (innerScope.x !== 16) { + throw new Test262Error('#1: innerScope.x === 16. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T1.js new file mode 100644 index 0000000000..46b239ec80 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.7_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x >>= y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 16; + } + }; + + with (scope) { + x >>= 3; + } + + if (scope.x !== 2) { + throw new Test262Error('#1: scope.x === 2. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T2.js new file mode 100644 index 0000000000..be9206bb29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.7_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x >>= y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 16; + } +}; + +with (scope) { + x >>= 3; +} + +if (scope.x !== 2) { + throw new Test262Error('#1: scope.x === 2. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T3.js new file mode 100644 index 0000000000..cd8ea99619 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.7_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x >>= y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 16; + } +}; + +with (outerScope) { + with (innerScope) { + x >>= 3; + } +} + +if (innerScope.x !== 2) { + throw new Test262Error('#1: innerScope.x === 2. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T1.js new file mode 100644 index 0000000000..b042f46dde --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.8_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x >>>= y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 16; + } + }; + + with (scope) { + x >>>= 3; + } + + if (scope.x !== 2) { + throw new Test262Error('#1: scope.x === 2. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T2.js new file mode 100644 index 0000000000..fb30c9d5d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.8_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x >>>= y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 16; + } +}; + +with (scope) { + x >>>= 3; +} + +if (scope.x !== 2) { + throw new Test262Error('#1: scope.x === 2. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T3.js new file mode 100644 index 0000000000..f5932e231c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.8_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x >>>= y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 16; + } +}; + +with (outerScope) { + with (innerScope) { + x >>>= 3; + } +} + +if (innerScope.x !== 2) { + throw new Test262Error('#1: innerScope.x === 2. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T1.js new file mode 100644 index 0000000000..11e84a9b79 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.9_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x &= y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 5; + } + }; + + with (scope) { + x &= 3; + } + + if (scope.x !== 1) { + throw new Test262Error('#1: scope.x === 1. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T2.js new file mode 100644 index 0000000000..8a81a95de1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.9_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x &= y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 5; + } +}; + +with (scope) { + x &= 3; +} + +if (scope.x !== 1) { + throw new Test262Error('#1: scope.x === 1. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T3.js new file mode 100644 index 0000000000..6dfd64aa2c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.9_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x &= y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 5; + } +}; + +with (outerScope) { + with (innerScope) { + x &= 3; + } +} + +if (innerScope.x !== 1) { + throw new Test262Error('#1: innerScope.x === 1. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.10_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.10_T1.js new file mode 100644 index 0000000000..6b4cbe0798 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.10_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.10_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x ^= y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 1; + var innerX = (function() { + x ^= (eval("var x = 2;"), 4); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 5) { + throw new Test262Error('#2: x === 5. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.11_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.11_T1.js new file mode 100644 index 0000000000..109c389db5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.11_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.11_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x |= y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 1; + var innerX = (function() { + x |= (eval("var x = 2;"), 4); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 5) { + throw new Test262Error('#2: x === 5. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.1_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.1_T1.js new file mode 100644 index 0000000000..86adf5d5fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.1_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.1_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x *= y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 3; + var innerX = (function() { + x *= (eval("var x = 2;"), 4); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 12) { + throw new Test262Error('#2: x === 12. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.2_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.2_T1.js new file mode 100644 index 0000000000..f74ec0fb7e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.2_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.2_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x /= y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 15; + var innerX = (function() { + x /= (eval("var x = 2;"), 3); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 5) { + throw new Test262Error('#2: x === 5. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.3_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.3_T1.js new file mode 100644 index 0000000000..1592b0c675 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.3_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.3_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x %= y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 7; + var innerX = (function() { + x %= (eval("var x = 2;"), 4); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 3) { + throw new Test262Error('#2: x === 3. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.4_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.4_T1.js new file mode 100644 index 0000000000..d11fadffc2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.4_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.4_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x += y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 3; + var innerX = (function() { + x += (eval("var x = 2;"), 1); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 4) { + throw new Test262Error('#2: x === 4. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.5_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.5_T1.js new file mode 100644 index 0000000000..f7731d0985 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.5_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.5_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x -= y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 5; + var innerX = (function() { + x -= (eval("var x = 2;"), 1); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 4) { + throw new Test262Error('#2: x === 4. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.6_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.6_T1.js new file mode 100644 index 0000000000..6590243878 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.6_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.6_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x <<= y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 1; + var innerX = (function() { + x <<= (eval("var x = 2;"), 3); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 8) { + throw new Test262Error('#2: x === 8. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.7_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.7_T1.js new file mode 100644 index 0000000000..30abe88d8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.7_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.7_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x >>= y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 8; + var innerX = (function() { + x >>= (eval("var x = 2;"), 1); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 4) { + throw new Test262Error('#2: x === 4. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.8_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.8_T1.js new file mode 100644 index 0000000000..01f0416ec7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.8_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.8_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x >>>= y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 8; + var innerX = (function() { + x >>>= (eval("var x = 2;"), 1); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 4) { + throw new Test262Error('#2: x === 4. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.9_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.9_T1.js new file mode 100644 index 0000000000..aae8537e0f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.9_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.9_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x &= y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 5; + var innerX = (function() { + x &= (eval("var x = 2;"), 3); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 1) { + throw new Test262Error('#2: x === 1. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T1.js new file mode 100644 index 0000000000..5c27a61259 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x ^= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] ^= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] ^= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T2.js new file mode 100644 index 0000000000..f622885f78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x ^= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] ^= expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] ^= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T3.js new file mode 100644 index 0000000000..9e4a3f1a15 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x ^= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] ^= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T4.js new file mode 100644 index 0000000000..ff695c43a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x ^= y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] ^= expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T1.js new file mode 100644 index 0000000000..49ea2c4ef7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x |= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] |= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] |= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T2.js new file mode 100644 index 0000000000..4c7041ebfd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x |= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] |= expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] |= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T3.js new file mode 100644 index 0000000000..65d03bf9cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x |= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] |= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T4.js new file mode 100644 index 0000000000..15feb15855 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x |= y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] |= expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T1.js new file mode 100644 index 0000000000..ad2e41b205 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x *= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] *= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] *= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T2.js new file mode 100644 index 0000000000..54c8008bda --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x *= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] *= expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] *= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T3.js new file mode 100644 index 0000000000..85b140c6d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x *= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] *= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T4.js new file mode 100644 index 0000000000..5fba889a16 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x *= y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] *= expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T1.js new file mode 100644 index 0000000000..cda71eeaac --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x /= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] /= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] /= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T2.js new file mode 100644 index 0000000000..2a8d5a043f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x /= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] /= expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] /= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T3.js new file mode 100644 index 0000000000..baab6dc1c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x /= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] /= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T4.js new file mode 100644 index 0000000000..7ed2022cb9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x /= y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] /= expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T1.js new file mode 100644 index 0000000000..e6a9bb1207 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x %= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] %= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] %= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T2.js new file mode 100644 index 0000000000..81eefd06c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x %= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] %= expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] %= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T3.js new file mode 100644 index 0000000000..06d2c500db --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x %= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] %= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T4.js new file mode 100644 index 0000000000..b406b3a09f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x %= y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] %= expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T1.js new file mode 100644 index 0000000000..738f93b099 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x += y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] += expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] += expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T2.js new file mode 100644 index 0000000000..5088f94841 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x += y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] += expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] += expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T3.js new file mode 100644 index 0000000000..4342e1f8be --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x += y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] += expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T4.js new file mode 100644 index 0000000000..ecf20f1f9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x += y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] += expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T1.js new file mode 100644 index 0000000000..1e688e5e0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x -= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] -= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] -= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T2.js new file mode 100644 index 0000000000..ad987fb7e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x -= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] -= expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] -= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T3.js new file mode 100644 index 0000000000..331ca21c1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x -= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] -= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T4.js new file mode 100644 index 0000000000..296954a4ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x -= y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] -= expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T1.js new file mode 100644 index 0000000000..07fb5b0dbd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x <<= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] <<= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] <<= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T2.js new file mode 100644 index 0000000000..baa7f62e1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x <<= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] <<= expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] <<= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T3.js new file mode 100644 index 0000000000..0d90ffd3aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x <<= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] <<= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T4.js new file mode 100644 index 0000000000..67605051a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x <<= y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] <<= expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T1.js new file mode 100644 index 0000000000..7ddb944e23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x >>= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] >>= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] >>= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T2.js new file mode 100644 index 0000000000..feb30a4fef --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x >>= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] >>= expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] >>= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T3.js new file mode 100644 index 0000000000..eeefc80916 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x >>= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] >>= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T4.js new file mode 100644 index 0000000000..f4ed7f80ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x >>= y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] >>= expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T1.js new file mode 100644 index 0000000000..f6d5071321 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x >>>= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] >>>= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] >>>= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T2.js new file mode 100644 index 0000000000..a9cfa6a6de --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x >>>= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] >>>= expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] >>>= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T3.js new file mode 100644 index 0000000000..96ec552572 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x >>>= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] >>>= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T4.js new file mode 100644 index 0000000000..6e8afd8de5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x >>>= y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] >>>= expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T1.js new file mode 100644 index 0000000000..15a44cc7b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x &= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] &= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] &= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T2.js new file mode 100644 index 0000000000..1884b2611a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x &= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] &= expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] &= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T3.js new file mode 100644 index 0000000000..40f836ec94 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x &= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] &= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T4.js new file mode 100644 index 0000000000..fcb6adb0a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x &= y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] &= expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/add-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/add-arguments-strict-strict.js new file mode 100644 index 0000000000..145758b184 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/add-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-15-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(+=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments += 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/add-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/add-eval-strict-strict.js new file mode 100644 index 0000000000..57bdddf5e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/add-eval-strict-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-4-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment operator(+=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval += 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/add-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/add-non-simple.js new file mode 100644 index 0000000000..1f94eb9e8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/add-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound addition assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 += 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/add-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/add-whitespace.js new file mode 100644 index 0000000000..6e63978f49 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/add-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T4 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x += y +---*/ + +var x; + +x = -1; +assert.sameValue(x += -1, -2, 'U+0009 (expression)'); +assert.sameValue(x, -2, 'U+0009 (side effect)'); + +x = -1; +assert.sameValue(x+=-1, -2, 'U+000B (expression)'); +assert.sameValue(x, -2, 'U+000B (side effect)'); + +x = -1; +assert.sameValue(x+=-1, -2, 'U+000C (expression)'); +assert.sameValue(x, -2, 'U+000C (side effect)'); + +x = -1; +assert.sameValue(x += -1, -2, 'U+0020 (expression)'); +assert.sameValue(x, -2, 'U+0020 (side effect)'); + +x = -1; +assert.sameValue(x += -1, -2, 'U+00A0 (expression)'); +assert.sameValue(x, -2, 'U+00A0 (side effect)'); + +x = -1; +assert.sameValue(x ++= +-1, -2, 'U+000A (expression)'); +assert.sameValue(x, -2, 'U+000A (side effect)'); + +x = -1; +assert.sameValue(x
+=
-1, -2, 'U+000D (expression)'); +assert.sameValue(x, -2, 'U+000D (side effect)'); + +x = -1; +assert.sameValue(x
+=
-1, -2, 'U+2028 (expression)'); +assert.sameValue(x, -2, 'U+2028 (side effect)'); + +x = -1; +assert.sameValue(x
+=
-1, -2, 'U+2029 (expression)'); +assert.sameValue(x, -2, 'U+2029 (side effect)'); + +x = -1; +assert.sameValue(x +
+= +
-1, -2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, -2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/and-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/and-arguments-strict-strict.js new file mode 100644 index 0000000000..65f5b03bc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/and-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-20-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(&=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments &= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/and-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/and-eval-strict-strict.js new file mode 100644 index 0000000000..4706382651 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/and-eval-strict-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-9-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment operator(&=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval &= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/and-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/and-whitespace.js new file mode 100644 index 0000000000..b4805bb278 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/and-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T9 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x &= y +---*/ + +var x; + +x = 1; +assert.sameValue(x &= 1, 1, 'U+0009 (expression)'); +assert.sameValue(x, 1, 'U+0009 (side effect)'); + +x = 1; +assert.sameValue(x&=1, 1, 'U+000B (expression)'); +assert.sameValue(x, 1, 'U+000B (side effect)'); + +x = 1; +assert.sameValue(x&=1, 1, 'U+000C (expression)'); +assert.sameValue(x, 1, 'U+000C (side effect)'); + +x = 1; +assert.sameValue(x &= 1, 1, 'U+0020 (expression)'); +assert.sameValue(x, 1, 'U+0020 (side effect)'); + +x = 1; +assert.sameValue(x &= 1, 1, 'U+00A0 (expression)'); +assert.sameValue(x, 1, 'U+00A0 (side effect)'); + +x = 1; +assert.sameValue(x +&= +1, 1, 'U+000A (expression)'); +assert.sameValue(x, 1, 'U+000A (side effect)'); + +x = 1; +assert.sameValue(x
&=
1, 1, 'U+000D (expression)'); +assert.sameValue(x, 1, 'U+000D (side effect)'); + +x = 1; +assert.sameValue(x
&=
1, 1, 'U+2028 (expression)'); +assert.sameValue(x, 1, 'U+2028 (side effect)'); + +x = 1; +assert.sameValue(x
&=
1, 1, 'U+2029 (expression)'); +assert.sameValue(x, 1, 'U+2029 (side effect)'); + +x = 1; +assert.sameValue(x +
&= +
1, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/browser.js b/js/src/tests/test262/language/expressions/compound-assignment/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/browser.js diff --git a/js/src/tests/test262/language/expressions/compound-assignment/btws-and-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/btws-and-non-simple.js new file mode 100644 index 0000000000..9b8361ef9e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/btws-and-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound "bitwise and" assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 &= 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/btws-or-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/btws-or-non-simple.js new file mode 100644 index 0000000000..d52e29b340 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/btws-or-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound "bitwise or" assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 |= 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/btws-xor-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/btws-xor-non-simple.js new file mode 100644 index 0000000000..9dff195e9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/btws-xor-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound "bitwise xor" assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 ^= 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--1.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--1.js new file mode 100644 index 0000000000..de0fa45112 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--1.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.10_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; + +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x ^= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--10.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--10.js new file mode 100644 index 0000000000..696b2a8784 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--10.js @@ -0,0 +1,43 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.4_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ + +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x += 1; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--11.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--11.js new file mode 100644 index 0000000000..f4d614ae06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--11.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.4_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x += 1; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--12.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--12.js new file mode 100644 index 0000000000..c589c1206e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--12.js @@ -0,0 +1,43 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.5_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x -= 1; + count++; + }); + count++; +})(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--13.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--13.js new file mode 100644 index 0000000000..35bc18dc14 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--13.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.5_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x -= 1; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--14.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--14.js new file mode 100644 index 0000000000..1e9c6279b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--14.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.6_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x <<= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--15.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--15.js new file mode 100644 index 0000000000..ae2a62b447 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--15.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.6_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x <<= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--16.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--16.js new file mode 100644 index 0000000000..fdaa5b9b3f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--16.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.7_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 16; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x >>= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--17.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--17.js new file mode 100644 index 0000000000..d9d57f34ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--17.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.7_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 16; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x >>= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--18.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--18.js new file mode 100644 index 0000000000..db1ec52a06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--18.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.8_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 16; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x >>>= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--19.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--19.js new file mode 100644 index 0000000000..3b6a864575 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--19.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.8_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 16; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x >>>= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--2.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--2.js new file mode 100644 index 0000000000..7cbe910c9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--2.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.11_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x |= 4; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--20.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--20.js new file mode 100644 index 0000000000..c106d4dd97 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--20.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.9_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 5; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x &= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--21.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--21.js new file mode 100644 index 0000000000..f758fa4426 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--21.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.9_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 5; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x &= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--3.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--3.js new file mode 100644 index 0000000000..37c46072fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--3.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.11_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x |= 4; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--4.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--4.js new file mode 100644 index 0000000000..cb3deef671 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--4.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.1_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x *= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--5.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--5.js new file mode 100644 index 0000000000..143fa2d1df --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--5.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.1_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x *= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--6.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--6.js new file mode 100644 index 0000000000..ac41064fec --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--6.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.2_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 6; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x /= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--7.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--7.js new file mode 100644 index 0000000000..caf84805a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--7.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.2_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 6; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x /= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--8.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--8.js new file mode 100644 index 0000000000..e593221296 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--8.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.3_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 5; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x %= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--9.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--9.js new file mode 100644 index 0000000000..90fe161825 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--9.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.3_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 5; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x %= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v-.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v-.js new file mode 100644 index 0000000000..4f13b58d74 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v-.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.10_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x ^= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/div-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/div-arguments-strict-strict.js new file mode 100644 index 0000000000..83b57671c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/div-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-13-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(/=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments /= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/div-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/div-eval-strict-strict.js new file mode 100644 index 0000000000..d65990a988 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/div-eval-strict-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-2-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment operator(/=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval /= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/div-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/div-non-simple.js new file mode 100644 index 0000000000..ce5a54be44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/div-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound division assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 /= 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/div-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/div-whitespace.js new file mode 100644 index 0000000000..5491504675 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/div-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T2 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x /= y +---*/ + +var x; + +x = -1; +assert.sameValue(x /= -1, 1, 'U+0009 (expression)'); +assert.sameValue(x, 1, 'U+0009 (side effect)'); + +x = -1; +assert.sameValue(x/=-1, 1, 'U+000B (expression)'); +assert.sameValue(x, 1, 'U+000B (side effect)'); + +x = -1; +assert.sameValue(x/=-1, 1, 'U+000C (expression)'); +assert.sameValue(x, 1, 'U+000C (side effect)'); + +x = -1; +assert.sameValue(x /= -1, 1, 'U+0020 (expression)'); +assert.sameValue(x, 1, 'U+0020 (side effect)'); + +x = -1; +assert.sameValue(x /= -1, 1, 'U+00A0 (expression)'); +assert.sameValue(x, 1, 'U+00A0 (side effect)'); + +x = -1; +assert.sameValue(x +/= +-1, 1, 'U+000A (expression)'); +assert.sameValue(x, 1, 'U+000A (side effect)'); + +x = -1; +assert.sameValue(x
/=
-1, 1, 'U+000D (expression)'); +assert.sameValue(x, 1, 'U+000D (side effect)'); + +x = -1; +assert.sameValue(x
/=
-1, 1, 'U+2028 (expression)'); +assert.sameValue(x, 1, 'U+2028 (side effect)'); + +x = -1; +assert.sameValue(x
/=
-1, 1, 'U+2029 (expression)'); +assert.sameValue(x, 1, 'U+2029 (side effect)'); + +x = -1; +assert.sameValue(x +
/= +
-1, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-add.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-add.js new file mode 100644 index 0000000000..0adbe1dc31 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-add.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/add.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound addition assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 1; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field += 2; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 3, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 3, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitand.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitand.js new file mode 100644 index 0000000000..c9683a4b0d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitand.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitand.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound bitwise-and assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 0b0101; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field &= 0b1010; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0b0000, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 0b0000, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitor.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitor.js new file mode 100644 index 0000000000..b14e2bb217 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitor.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitor.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound bitwise-or assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 0b0101; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field |= 0b1010; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0b1111, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 0b1111, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitxor.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitxor.js new file mode 100644 index 0000000000..28d203b234 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitxor.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitxor.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound bitwise-xor assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 0x1111; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field ^= 0x1010; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0x0101, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 0x0101, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-div.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-div.js new file mode 100644 index 0000000000..99eb2feda5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-div.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/div.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound division assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 1; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field /= 2; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0.5, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 0.5, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-exp.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-exp.js new file mode 100644 index 0000000000..309c23fad1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-exp.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/exp.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound exponentiation assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [exponentiation, class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 10; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field **= 3; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 1000, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 1000, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-lshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-lshift.js new file mode 100644 index 0000000000..d651584439 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-lshift.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/lshift.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound left-shift assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 0b0110; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field <<= 4; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0b01100000, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 0b01100000, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mod.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mod.js new file mode 100644 index 0000000000..1b54a87119 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mod.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/mod.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound modulo assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 3; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field %= 2; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 1, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 1, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mult.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mult.js new file mode 100644 index 0000000000..788535e828 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mult.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/mult.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound multiplication assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 2; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field *= 3; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 6, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 6, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-rshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-rshift.js new file mode 100644 index 0000000000..9f5720e576 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-rshift.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/rshift.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound right-shift assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 0b1100; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field >>>= 2; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0b0011, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 0b0011, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-srshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-srshift.js new file mode 100644 index 0000000000..29ee0aa6a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-srshift.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/srshift.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound signed-right-shift assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 0b1100; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field >>= 2; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0b0011, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 0b0011, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-sub.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-sub.js new file mode 100644 index 0000000000..43269fb797 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-sub.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/sub.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound subtraction assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 3; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field -= 2; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 1, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 1, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-add.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-add.js new file mode 100644 index 0000000000..da3f639be3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-add.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/add.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound addition assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 1; + compoundAssignment() { + return this.#field += 2; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 3, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 3, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitand.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitand.js new file mode 100644 index 0000000000..5c2b4747a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitand.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitand.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound bitwise-and assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 0b0101; + compoundAssignment() { + return this.#field &= 0b1010; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0b0000, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 0b0000, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitor.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitor.js new file mode 100644 index 0000000000..653c0cff81 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitor.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitor.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound bitwise-or assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 0b0101; + compoundAssignment() { + return this.#field |= 0b1010; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0b1111, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 0b1111, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitxor.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitxor.js new file mode 100644 index 0000000000..499df6df35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitxor.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitxor.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound bitwise-xor assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 0x1111; + compoundAssignment() { + return this.#field ^= 0x1010; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0x0101, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 0x0101, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-div.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-div.js new file mode 100644 index 0000000000..2906c7dddb --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-div.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/div.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound division assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 1; + compoundAssignment() { + return this.#field /= 2; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0.5, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 0.5, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-exp.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-exp.js new file mode 100644 index 0000000000..368fa1728e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-exp.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/exp.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound exponentiation assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [exponentiation, class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 10; + compoundAssignment() { + return this.#field **= 3; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 1000, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 1000, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-lshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-lshift.js new file mode 100644 index 0000000000..7f17309635 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-lshift.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/lshift.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound left-shift assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 0b0110; + compoundAssignment() { + return this.#field <<= 4; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0b01100000, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 0b01100000, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-mod.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-mod.js new file mode 100644 index 0000000000..8104ea3b76 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-mod.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/mod.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound modulo assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 3; + compoundAssignment() { + return this.#field %= 2; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 1, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 1, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-mult.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-mult.js new file mode 100644 index 0000000000..731a259be9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-mult.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/mult.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound multiplication assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 2; + compoundAssignment() { + return this.#field *= 3; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 6, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 6, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-rshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-rshift.js new file mode 100644 index 0000000000..3969e09d86 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-rshift.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/rshift.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound right-shift assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 0b1100; + compoundAssignment() { + return this.#field >>>= 2; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0b0011, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 0b0011, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-srshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-srshift.js new file mode 100644 index 0000000000..ac5f3c8d0e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-srshift.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/srshift.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound signed-right-shift assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 0b1100; + compoundAssignment() { + return this.#field >>= 2; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0b0011, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 0b0011, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-sub.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-sub.js new file mode 100644 index 0000000000..1d6d12de8c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-sub.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/sub.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound subtraction assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 3; + compoundAssignment() { + return this.#field -= 2; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 1, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 1, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-add.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-add.js new file mode 100644 index 0000000000..bc4584acf7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-add.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/add.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound addition assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod += 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitand.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitand.js new file mode 100644 index 0000000000..88d4ba9fd2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitand.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitand.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound bitwise-and assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod &= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitor.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitor.js new file mode 100644 index 0000000000..2b184c370e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitor.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitor.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound bitwise-or assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod |= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitxor.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitxor.js new file mode 100644 index 0000000000..54a8597e54 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitxor.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitxor.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound bitwise-xor assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod ^= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-div.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-div.js new file mode 100644 index 0000000000..af4370bba5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-div.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/div.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound division assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod /= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-exp.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-exp.js new file mode 100644 index 0000000000..7c98267457 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-exp.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/exp.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound exponentiation assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [exponentiation, class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod **= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-lshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-lshift.js new file mode 100644 index 0000000000..11af1cbb57 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-lshift.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/lshift.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound left-shift assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod <<= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-mod.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-mod.js new file mode 100644 index 0000000000..26e5d0b8d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-mod.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/mod.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound modulo assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod %= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-mult.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-mult.js new file mode 100644 index 0000000000..0edfcd0f7d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-mult.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/mult.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound multiplication assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod *= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-rshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-rshift.js new file mode 100644 index 0000000000..ba0727fb07 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-rshift.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/rshift.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound right-shift assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod >>>= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-srshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-srshift.js new file mode 100644 index 0000000000..f7a5df37bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-srshift.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/srshift.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound signed-right-shift assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod >>= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-sub.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-sub.js new file mode 100644 index 0000000000..5f473bd99b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-sub.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/sub.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound subtraction assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod -= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-add.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-add.js new file mode 100644 index 0000000000..4bedca0b25 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-add.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/add.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound addition assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field += 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitand.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitand.js new file mode 100644 index 0000000000..54c16908a6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitand.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitand.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound bitwise-and assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field &= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitor.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitor.js new file mode 100644 index 0000000000..ab78b7df37 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitor.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitor.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound bitwise-or assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field |= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitxor.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitxor.js new file mode 100644 index 0000000000..66e8cdb061 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitxor.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitxor.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound bitwise-xor assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field ^= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-div.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-div.js new file mode 100644 index 0000000000..1378f4870e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-div.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/div.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound division assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field /= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-exp.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-exp.js new file mode 100644 index 0000000000..b65039627c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-exp.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/exp.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound exponentiation assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [exponentiation, class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field **= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-lshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-lshift.js new file mode 100644 index 0000000000..c1fb6a7284 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-lshift.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/lshift.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound left-shift assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field <<= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-mod.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-mod.js new file mode 100644 index 0000000000..e1c2491bfc --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-mod.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/mod.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound modulo assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field %= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-mult.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-mult.js new file mode 100644 index 0000000000..b611243ecb --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-mult.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/mult.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound multiplication assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field *= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-rshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-rshift.js new file mode 100644 index 0000000000..5c969340f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-rshift.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/rshift.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound right-shift assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field >>>= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-srshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-srshift.js new file mode 100644 index 0000000000..ac393d51a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-srshift.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/srshift.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound signed-right-shift assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field >>= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-sub.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-sub.js new file mode 100644 index 0000000000..20067bd51f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-sub.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/sub.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound subtraction assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field -= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-shift-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/left-shift-non-simple.js new file mode 100644 index 0000000000..829fbaee21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-shift-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound "left shift" assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 <<= 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/lshift-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/lshift-arguments-strict-strict.js new file mode 100644 index 0000000000..7704c1372c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/lshift-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-17-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(<<=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments <<= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/lshift-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/lshift-eval-strict-strict.js new file mode 100644 index 0000000000..c292a4521e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/lshift-eval-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-6-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment + operator(<<=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval <<= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/lshift-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/lshift-whitespace.js new file mode 100644 index 0000000000..3036e42e4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/lshift-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T6 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x <<= y +---*/ + +var x; + +x = 1; +assert.sameValue(x <<= 1, 2, 'U+0009 (expression)'); +assert.sameValue(x, 2, 'U+0009 (side effect)'); + +x = 1; +assert.sameValue(x<<=1, 2, 'U+000B (expression)'); +assert.sameValue(x, 2, 'U+000B (side effect)'); + +x = 1; +assert.sameValue(x<<=1, 2, 'U+000C (expression)'); +assert.sameValue(x, 2, 'U+000C (side effect)'); + +x = 1; +assert.sameValue(x <<= 1, 2, 'U+0020 (expression)'); +assert.sameValue(x, 2, 'U+0020 (side effect)'); + +x = 1; +assert.sameValue(x <<= 1, 2, 'U+00A0 (expression)'); +assert.sameValue(x, 2, 'U+00A0 (side effect)'); + +x = 1; +assert.sameValue(x +<<= +1, 2, 'U+000A (expression)'); +assert.sameValue(x, 2, 'U+000A (side effect)'); + +x = 1; +assert.sameValue(x
<<=
1, 2, 'U+000D (expression)'); +assert.sameValue(x, 2, 'U+000D (side effect)'); + +x = 1; +assert.sameValue(x
<<=
1, 2, 'U+2028 (expression)'); +assert.sameValue(x, 2, 'U+2028 (side effect)'); + +x = 1; +assert.sameValue(x
<<=
1, 2, 'U+2029 (expression)'); +assert.sameValue(x, 2, 'U+2029 (side effect)'); + +x = 1; +assert.sameValue(x +
<<= +
1, 2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/mod-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/mod-arguments-strict-strict.js new file mode 100644 index 0000000000..cf5071d6da --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/mod-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-14-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(%=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments %= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/mod-div-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/mod-div-non-simple.js new file mode 100644 index 0000000000..a66a73279d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/mod-div-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound "modular division" assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 %= 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/mod-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/mod-eval-strict-strict.js new file mode 100644 index 0000000000..9332c16cf5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/mod-eval-strict-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-3-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment operator(%=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval %= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/mod-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/mod-whitespace.js new file mode 100644 index 0000000000..e9059eda6f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/mod-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T3 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x %= y +---*/ + +var x; + +x = -1; +assert.sameValue(x %= -1, -0, 'U+0009 (expression)'); +assert.sameValue(x, -0, 'U+0009 (side effect)'); + +x = -1; +assert.sameValue(x%=-1, -0, 'U+000B (expression)'); +assert.sameValue(x, -0, 'U+000B (side effect)'); + +x = -1; +assert.sameValue(x%=-1, -0, 'U+000C (expression)'); +assert.sameValue(x, -0, 'U+000C (side effect)'); + +x = -1; +assert.sameValue(x %= -1, -0, 'U+0020 (expression)'); +assert.sameValue(x, -0, 'U+0020 (side effect)'); + +x = -1; +assert.sameValue(x %= -1, -0, 'U+00A0 (expression)'); +assert.sameValue(x, -0, 'U+00A0 (side effect)'); + +x = -1; +assert.sameValue(x +%= +-1, -0, 'U+000A (expression)'); +assert.sameValue(x, -0, 'U+000A (side effect)'); + +x = -1; +assert.sameValue(x
%=
-1, -0, 'U+000D (expression)'); +assert.sameValue(x, -0, 'U+000D (side effect)'); + +x = -1; +assert.sameValue(x
%=
-1, -0, 'U+2028 (expression)'); +assert.sameValue(x, -0, 'U+2028 (side effect)'); + +x = -1; +assert.sameValue(x
%=
-1, -0, 'U+2029 (expression)'); +assert.sameValue(x, -0, 'U+2029 (side effect)'); + +x = -1; +assert.sameValue(x +
%= +
-1, -0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, -0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/mult-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/mult-arguments-strict-strict.js new file mode 100644 index 0000000000..ff130c7fdb --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/mult-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-12-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(*=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments *= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/mult-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/mult-eval-strict-strict.js new file mode 100644 index 0000000000..e3b9571c33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/mult-eval-strict-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-1-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment operator(*=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval *= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/mult-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/mult-non-simple.js new file mode 100644 index 0000000000..ca674a09d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/mult-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound multiplication assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 *= 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/mult-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/mult-whitespace.js new file mode 100644 index 0000000000..610f11b3a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/mult-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T1 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x *= y +---*/ + +var x; + +x = -1; +assert.sameValue(x *= -1, 1, 'U+0009 (expression)'); +assert.sameValue(x, 1, 'U+0009 (side effect)'); + +x = -1; +assert.sameValue(x*=-1, 1, 'U+000B (expression)'); +assert.sameValue(x, 1, 'U+000B (side effect)'); + +x = -1; +assert.sameValue(x*=-1, 1, 'U+000C (expression)'); +assert.sameValue(x, 1, 'U+000C (side effect)'); + +x = -1; +assert.sameValue(x *= -1, 1, 'U+0020 (expression)'); +assert.sameValue(x, 1, 'U+0020 (side effect)'); + +x = -1; +assert.sameValue(x *= -1, 1, 'U+00A0 (expression)'); +assert.sameValue(x, 1, 'U+00A0 (side effect)'); + +x = -1; +assert.sameValue(x +*= +-1, 1, 'U+000A (expression)'); +assert.sameValue(x, 1, 'U+000A (side effect)'); + +x = -1; +assert.sameValue(x
*=
-1, 1, 'U+000D (expression)'); +assert.sameValue(x, 1, 'U+000D (side effect)'); + +x = -1; +assert.sameValue(x
*=
-1, 1, 'U+2028 (expression)'); +assert.sameValue(x, 1, 'U+2028 (side effect)'); + +x = -1; +assert.sameValue(x
*=
-1, 1, 'U+2029 (expression)'); +assert.sameValue(x, 1, 'U+2029 (side effect)'); + +x = -1; +assert.sameValue(x +
*= +
-1, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/or-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/or-arguments-strict-strict.js new file mode 100644 index 0000000000..6c2d92d29f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/or-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-22-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(|=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments |= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/or-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/or-eval-strict-strict.js new file mode 100644 index 0000000000..65f633282a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/or-eval-strict-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-11-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment operator(|=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval |= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/or-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/or-whitespace.js new file mode 100644 index 0000000000..a8558ffd7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/or-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T11 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x |= y +---*/ + +var x; + +x = 0; +assert.sameValue(x |= 1, 1, 'U+0009 (expression)'); +assert.sameValue(x, 1, 'U+0009 (side effect)'); + +x = 0; +assert.sameValue(x|=1, 1, 'U+000B (expression)'); +assert.sameValue(x, 1, 'U+000B (side effect)'); + +x = 0; +assert.sameValue(x|=1, 1, 'U+000C (expression)'); +assert.sameValue(x, 1, 'U+000C (side effect)'); + +x = 0; +assert.sameValue(x |= 1, 1, 'U+0020 (expression)'); +assert.sameValue(x, 1, 'U+0020 (side effect)'); + +x = 0; +assert.sameValue(x |= 1, 1, 'U+00A0 (expression)'); +assert.sameValue(x, 1, 'U+00A0 (side effect)'); + +x = 0; +assert.sameValue(x +|= +1, 1, 'U+000A (expression)'); +assert.sameValue(x, 1, 'U+000A (side effect)'); + +x = 0; +assert.sameValue(x
|=
1, 1, 'U+000D (expression)'); +assert.sameValue(x, 1, 'U+000D (side effect)'); + +x = 0; +assert.sameValue(x
|=
1, 1, 'U+2028 (expression)'); +assert.sameValue(x, 1, 'U+2028 (side effect)'); + +x = 0; +assert.sameValue(x
|=
1, 1, 'U+2029 (expression)'); +assert.sameValue(x, 1, 'U+2029 (side effect)'); + +x = 0; +assert.sameValue(x +
|= +
1, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/right-shift-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/right-shift-non-simple.js new file mode 100644 index 0000000000..7e814e2223 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/right-shift-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound "right shift" assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 >>= 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/shell.js b/js/src/tests/test262/language/expressions/compound-assignment/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/shell.js diff --git a/js/src/tests/test262/language/expressions/compound-assignment/srshift-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/srshift-arguments-strict-strict.js new file mode 100644 index 0000000000..00ef900315 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/srshift-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-18-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(>>=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments >>= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/srshift-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/srshift-eval-strict-strict.js new file mode 100644 index 0000000000..e197aab414 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/srshift-eval-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-7-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment + operator(>>=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval >>= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/srshift-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/srshift-whitespace.js new file mode 100644 index 0000000000..4e4675045f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/srshift-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T7 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x >>= y +---*/ + +var x; + +x = 1; +assert.sameValue(x >>= 1, 0, 'U+0009 (expression)'); +assert.sameValue(x, 0, 'U+0009 (side effect)'); + +x = 1; +assert.sameValue(x>>=1, 0, 'U+000B (expression)'); +assert.sameValue(x, 0, 'U+000B (side effect)'); + +x = 1; +assert.sameValue(x>>=1, 0, 'U+000C (expression)'); +assert.sameValue(x, 0, 'U+000C (side effect)'); + +x = 1; +assert.sameValue(x >>= 1, 0, 'U+0020 (expression)'); +assert.sameValue(x, 0, 'U+0020 (side effect)'); + +x = 1; +assert.sameValue(x >>= 1, 0, 'U+00A0 (expression)'); +assert.sameValue(x, 0, 'U+00A0 (side effect)'); + +x = 1; +assert.sameValue(x +>>= +1, 0, 'U+000A (expression)'); +assert.sameValue(x, 0, 'U+000A (side effect)'); + +x = 1; +assert.sameValue(x
>>=
1, 0, 'U+000D (expression)'); +assert.sameValue(x, 0, 'U+000D (side effect)'); + +x = 1; +assert.sameValue(x
>>=
1, 0, 'U+2028 (expression)'); +assert.sameValue(x, 0, 'U+2028 (side effect)'); + +x = 1; +assert.sameValue(x
>>=
1, 0, 'U+2029 (expression)'); +assert.sameValue(x, 0, 'U+2029 (side effect)'); + +x = 1; +assert.sameValue(x +
>>= +
1, 0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/sub-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/sub-arguments-strict-strict.js new file mode 100644 index 0000000000..0bd8b2cd0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/sub-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-16-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(-=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments -= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/sub-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/sub-eval-strict-strict.js new file mode 100644 index 0000000000..a8b98e484d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/sub-eval-strict-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-5-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment operator(-=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval -= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/sub-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/sub-whitespace.js new file mode 100644 index 0000000000..69f19463c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/sub-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T5 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x -= y +---*/ + +var x; + +x = -1; +assert.sameValue(x -= 1, -2, 'U+0009 (expression)'); +assert.sameValue(x, -2, 'U+0009 (side effect)'); + +x = -1; +assert.sameValue(x-=1, -2, 'U+000B (expression)'); +assert.sameValue(x, -2, 'U+000B (side effect)'); + +x = -1; +assert.sameValue(x-=1, -2, 'U+000C (expression)'); +assert.sameValue(x, -2, 'U+000C (side effect)'); + +x = -1; +assert.sameValue(x -= 1, -2, 'U+0020 (expression)'); +assert.sameValue(x, -2, 'U+0020 (side effect)'); + +x = -1; +assert.sameValue(x -= 1, -2, 'U+00A0 (expression)'); +assert.sameValue(x, -2, 'U+00A0 (side effect)'); + +x = -1; +assert.sameValue(x +-= +1, -2, 'U+000A (expression)'); +assert.sameValue(x, -2, 'U+000A (side effect)'); + +x = -1; +assert.sameValue(x
-=
1, -2, 'U+000D (expression)'); +assert.sameValue(x, -2, 'U+000D (side effect)'); + +x = -1; +assert.sameValue(x
-=
1, -2, 'U+2028 (expression)'); +assert.sameValue(x, -2, 'U+2028 (side effect)'); + +x = -1; +assert.sameValue(x
-=
1, -2, 'U+2029 (expression)'); +assert.sameValue(x, -2, 'U+2029 (side effect)'); + +x = -1; +assert.sameValue(x +
-= +
1, -2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, -2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/subtract-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/subtract-non-simple.js new file mode 100644 index 0000000000..b7287ac573 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/subtract-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound subtraction assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 -= 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/u-right-shift-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/u-right-shift-non-simple.js new file mode 100644 index 0000000000..3ebdab7788 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/u-right-shift-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound "unsigned right shift" assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 >>>= 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/urshift-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/urshift-arguments-strict-strict.js new file mode 100644 index 0000000000..234f7bd714 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/urshift-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-19-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(>>>=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments >>>= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/urshift-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/urshift-eval-strict-strict.js new file mode 100644 index 0000000000..6db086ec18 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/urshift-eval-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-8-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment + operator(>>>=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval >>>= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/urshift-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/urshift-whitespace.js new file mode 100644 index 0000000000..a17a46973d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/urshift-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T8 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x >>>= y +---*/ + +var x; + +x = 1; +assert.sameValue(x >>>= 1, 0, 'U+0009 (expression)'); +assert.sameValue(x, 0, 'U+0009 (side effect)'); + +x = 1; +assert.sameValue(x>>>=1, 0, 'U+000B (expression)'); +assert.sameValue(x, 0, 'U+000B (side effect)'); + +x = 1; +assert.sameValue(x>>>=1, 0, 'U+000C (expression)'); +assert.sameValue(x, 0, 'U+000C (side effect)'); + +x = 1; +assert.sameValue(x >>>= 1, 0, 'U+0020 (expression)'); +assert.sameValue(x, 0, 'U+0020 (side effect)'); + +x = 1; +assert.sameValue(x >>>= 1, 0, 'U+00A0 (expression)'); +assert.sameValue(x, 0, 'U+00A0 (side effect)'); + +x = 1; +assert.sameValue(x +>>>= +1, 0, 'U+000A (expression)'); +assert.sameValue(x, 0, 'U+000A (side effect)'); + +x = 1; +assert.sameValue(x
>>>=
1, 0, 'U+000D (expression)'); +assert.sameValue(x, 0, 'U+000D (side effect)'); + +x = 1; +assert.sameValue(x
>>>=
1, 0, 'U+2028 (expression)'); +assert.sameValue(x, 0, 'U+2028 (side effect)'); + +x = 1; +assert.sameValue(x
>>>=
1, 0, 'U+2029 (expression)'); +assert.sameValue(x, 0, 'U+2029 (side effect)'); + +x = 1; +assert.sameValue(x +
>>>= +
1, 0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/xor-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/xor-arguments-strict-strict.js new file mode 100644 index 0000000000..0f50993e5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/xor-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-21-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(^=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments ^= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/xor-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/xor-eval-strict-strict.js new file mode 100644 index 0000000000..55fb822df1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/xor-eval-strict-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-10-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment operator(^=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval ^= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/xor-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/xor-whitespace.js new file mode 100644 index 0000000000..7baad7be85 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/xor-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T10 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x ^= y +---*/ + +var x; + +x = 1; +assert.sameValue(x ^= 1, 0, 'U+0009 (expression)'); +assert.sameValue(x, 0, 'U+0009 (side effect)'); + +x = 1; +assert.sameValue(x^=1, 0, 'U+000B (expression)'); +assert.sameValue(x, 0, 'U+000B (side effect)'); + +x = 1; +assert.sameValue(x^=1, 0, 'U+000C (expression)'); +assert.sameValue(x, 0, 'U+000C (side effect)'); + +x = 1; +assert.sameValue(x ^= 1, 0, 'U+0020 (expression)'); +assert.sameValue(x, 0, 'U+0020 (side effect)'); + +x = 1; +assert.sameValue(x ^= 1, 0, 'U+00A0 (expression)'); +assert.sameValue(x, 0, 'U+00A0 (side effect)'); + +x = 1; +assert.sameValue(x +^= +1, 0, 'U+000A (expression)'); +assert.sameValue(x, 0, 'U+000A (side effect)'); + +x = 1; +assert.sameValue(x
^=
1, 0, 'U+000D (expression)'); +assert.sameValue(x, 0, 'U+000D (side effect)'); + +x = 1; +assert.sameValue(x
^=
1, 0, 'U+2028 (expression)'); +assert.sameValue(x, 0, 'U+2028 (side effect)'); + +x = 1; +assert.sameValue(x
^=
1, 0, 'U+2029 (expression)'); +assert.sameValue(x, 0, 'U+2029 (side effect)'); + +x = 1; +assert.sameValue(x +
^= +
1, 0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); |