summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.3_T1.js
blob: afe2057c2209c199c48f24d4c80f1184a09da953 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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) {
    $ERROR('#1: innerX === 2. Actual: ' + (innerX));
  }
  if (x !== 3) {
    $ERROR('#2: x === 3. Actual: ' + (x));
  }
}
testCompoundAssignment();

reportCompare(0, 0);