From 0ceb428ec93cda5c63f470c0f9d5552441bbc32d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Mon, 8 Sep 2014 21:23:39 +0200 Subject: Add test coverage for identifier resolution in dynamic scopes Identifier resolution in dynamic scope context is missing test coverage, resolves https://bugs.ecmascript.org/show_bug.cgi?id=1751 . --- .../compound-assignment/S11.13.2_A6.4_T1.js | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 test/language/expressions/compound-assignment/S11.13.2_A6.4_T1.js (limited to 'test/language/expressions/compound-assignment/S11.13.2_A6.4_T1.js') diff --git a/test/language/expressions/compound-assignment/S11.13.2_A6.4_T1.js b/test/language/expressions/compound-assignment/S11.13.2_A6.4_T1.js new file mode 100755 index 000000000..3bb0664ff --- /dev/null +++ b/test/language/expressions/compound-assignment/S11.13.2_A6.4_T1.js @@ -0,0 +1,29 @@ +// 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) +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) { + $ERROR('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 4) { + $ERROR('#2: x === 4. Actual: ' + (x)); + } +} +testCompoundAssignment(); -- cgit v1.2.1