2 'Tests whether eval() works inside statements that read and modify a value.'
47 function urshiftTest()
96 function postIncTest()
103 function postDecTest()
105 var x = { value: 0 };
107 return x.value == -1;
110 function primitiveThisTest()
112 // Test that conversion of this is persistant over multiple calls to eval,
113 // even where 'this' is not directly used within the function.
114 eval('this.value = "Seekrit message";');
115 return eval('this.value') === "Seekrit message";
118 function strictThisTest()
120 // In a strict mode function primitive this values are not converted, so
121 // the property access in the first eval is writing a value to a temporary
122 // object, and should not be observed by the second eval.
124 eval('this.value = "Seekrit message";');
125 return eval('this.value') === undefined;
128 shouldBeTrue('multTest();');
129 shouldBeTrue('divTest();');
130 shouldBeTrue('addTest();');
131 shouldBeTrue('subTest();');
132 shouldBeTrue('lshiftTest();');
133 shouldBeTrue('rshiftTest();');
134 shouldBeTrue('urshiftTest();');
135 shouldBeTrue('andTest();');
136 shouldBeTrue('xorTest();');
137 shouldBeTrue('orTest();');
138 shouldBeTrue('modTest();');
140 shouldBeTrue('preIncTest();');
141 shouldBeTrue('preDecTest();');
142 shouldBeTrue('postIncTest();');
143 shouldBeTrue('postDecTest();');
145 shouldBeTrue('primitiveThisTest.call(1);');
146 shouldBeTrue('strictThisTest.call(1);');