Home | History | Annotate | Download | only in mjsunit
      1 // Copyright 2015 the V8 project authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 
      6 (function TestSloppyMode() {
      7   var e = 1, a = 2;
      8   var o = {
      9     get eval() {
     10       return e;
     11     },
     12     set eval(v) {
     13       e = v;
     14     },
     15     get arguments() {
     16       return a;
     17     },
     18     set arguments(v) {
     19       a = v;
     20     },
     21   };
     22 
     23   assertEquals(1, o.eval);
     24   o.eval = 3;
     25   assertEquals(3, e);
     26 
     27   assertEquals(2, o.arguments);
     28   o.arguments = 4;
     29   assertEquals(4, a);
     30 })();
     31 
     32 
     33 (function TestStrictMode() {
     34   'use strict';
     35 
     36   var e = 1, a = 2;
     37   var o = {
     38     get eval() {
     39       return e;
     40     },
     41     set eval(v) {
     42       e = v;
     43     },
     44     get arguments() {
     45       return a;
     46     },
     47     set arguments(v) {
     48       a = v;
     49     },
     50   };
     51 
     52   assertEquals(1, o.eval);
     53   o.eval = 3;
     54   assertEquals(3, e);
     55 
     56   assertEquals(2, o.arguments);
     57   o.arguments = 4;
     58   assertEquals(4, a);
     59 })();
     60