Skip to content
Snippets Groups Projects
Commit 1a479392 authored by André Bargull's avatar André Bargull
Browse files

Fix strict mode errors in language/expressions

- Add missing noStrict flags when tests explicitly require non-strict semantics (e.g. unqualified delete, with statement)
- Change `throw new Exception(...)` to `$ERROR(...)` in call/*
- Replace dynamic strict mode check with noStrict flag in call/11.2.3-3_8
- Align assignment/11.13.1_A3.1 with 11.13.1_A3.2 to avoid creating implicit global variable
- Split test into multiple files when undeclared variable are under test
  - addition/S11.6.1_A2.4_T3
  - division/11.5.2_A2.4_T3
  - does-not-equals/11.9.2_A2.4_T3
  - equals/S11.9.1_A2.4_T3
  - greater-than/S11.8.2_A2.4_T3
  - greater-than-or-equal/S11.8.4_A2.4_T3
  - in/S11.8.7_A2.4_T3
  - instanceof/11.8.6_A2.4_T3
  - left-shift/S11.7.1_A2.4_T3
  - less-than/S11.8.1_A2.4_T3
  - less-than-or-equal/S11.8.3_A2.4_T3
  - modulus/S11.5.3_A2.4_T3
  - multiplication/11.5.1_A2.4_T3
  - right-shift/11.7.2_A2.4_T3
  - strict-does-not-equals/11.9.5_A2.4_T3
  - strict-equals/11.9.4_A2.4_T3
  - subtraction/11.6.2_A2.4_T3
  - unsigned-right-shift/11.7.3_A2.4_T3
- Add declaration when implicit global variable creation not part of the test
  - assignment/11.13.1_A4_T1
  - compound-assignment/S11.13.2_A3.1_T*
  - compound-assignment/S11.13.2_A3.2_T*
  - grouping/11.1.6_A3_T5
  - instanceof/S15.3.5.3_*
- Split test into multiple files when unqualified delete is used
  - delete/S11.4.1_A2.2_T1.js
  - delete/11.4.1_A3.2
  - grouping/S11.1.6_A2
  - grouping/S11.1.6_A3_T6
parent 49abae4f
No related branches found
No related tags found
No related merge requests found
Showing
with 35 additions and 21 deletions
......@@ -17,8 +17,3 @@ catch (e) {
$ERROR('#1.2: x + (x = 1) throw ReferenceError. Actual: ' + (e));
}
}
//CHECK#2
if ((y = 1) + y !== 2) {
$ERROR('#2: (y = 1) + y === 2. Actual: ' + ((y = 1) + y));
}
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: First expression is evaluated first, and then second expression
es5id: 11.6.1_A2.4_T4
description: Checking with undeclarated variables
flags: [noStrict]
---*/
//CHECK#1
if ((y = 1) + y !== 2) {
$ERROR('#1: (y = 1) + y === 2. Actual: ' + ((y = 1) + y));
}
......@@ -10,6 +10,7 @@ es5id: 11.13.1-4-1
description: >
simple assignment creates property on the global object if
LeftHandSide is an unresolvable reference
flags: [noStrict]
includes:
- runTestCase.js
- fnGlobalObject.js
......
......@@ -7,6 +7,7 @@
/*---
es5id: 8.14.4-8-b_1
description: Non-writable property on a prototype written to.
flags: [noStrict]
includes: [runTestCase.js]
---*/
......
......@@ -14,7 +14,7 @@ if (x !== 1) {
}
//CHECK#2
y = 1;
if (y !== 1) {
$ERROR('#2: y = 1; y === 1. Actual: ' + (y));
x = 1;
if (x !== 1) {
$ERROR('#2: x = 1; x === 1. Actual: ' + (x));
}
......@@ -8,6 +8,7 @@ description: Syntax check
---*/
//CHECK#1
var x;
x = x = 1;
if (x !== 1) {
$ERROR('#1: The expression x = x = 1 is the same x = (x = 1), not (x = x) = 1. Actual: ' + (x));
......
......@@ -19,7 +19,7 @@ function testcase() {
var o = { };
try {
o.bar( foo() );
throw new Exception("o.bar does not exist!");
$ERROR("o.bar does not exist!");
} catch(e) {
return (e instanceof TypeError) && (fooCalled===true);
}
......
......@@ -19,7 +19,7 @@ function testcase() {
var o = { };
try {
o.bar( foo() );
throw new Exception("o.bar does not exist!");
$ERROR("o.bar does not exist!");
} catch(e) {
return (e instanceof TypeError) && (fooCalled===true);
}
......
......@@ -19,7 +19,7 @@ function testcase() {
var o = { };
try {
o.bar.gar( foo() );
throw new Exception("o.bar does not exist!");
$ERROR("o.bar does not exist!");
} catch(e) {
return (e instanceof TypeError) && (fooCalled===false);
}
......
......@@ -21,7 +21,7 @@ function testcase() {
set: function(x) {this.barSetter = true; }});
try {
o.bar( foo() );
throw new Exception("o.bar does not exist!");
$ERROR("o.bar does not exist!");
} catch(e) {
return (e instanceof TypeError) && (fooCalled===true) && (o.barGetter===true) && (o.barSetter===undefined);
}
......
......@@ -19,7 +19,7 @@ function testcase() {
var o = { };
try {
eval("o.bar( foo() );");
throw new Exception("o.bar does not exist!");
$ERROR("o.bar does not exist!");
} catch(e) {
return (e instanceof TypeError) && (fooCalled===true);
}
......
......@@ -18,7 +18,7 @@ function testcase() {
set: function(x) {this.barSetter = true; }});
try {
o.foo( o.bar );
throw new Exception("o.foo does not exist!");
$ERROR("o.foo does not exist!");
} catch(e) {
return (e instanceof TypeError) && (o.barGetter===true) && (o.barSetter===undefined);
}
......
......@@ -18,7 +18,7 @@ function testcase() {
set: function(x) {this.barSetter = true; }});
try {
o.foo( o["bar"] );
throw new Exception("o.foo does not exist!");
$ERROR("o.foo does not exist!");
} catch(e) {
return (e instanceof TypeError) && (o.barGetter===true) && (o.barSetter===undefined);
}
......
......@@ -9,22 +9,18 @@ es5id: 11.2.3-3_8
description: >
Call arguments are evaluated before the check is made to see if
the object is actually callable (global object)
flags: [noStrict]
includes:
- runTestCase.js
- fnGlobalObject.js
---*/
function testcase() {
if (this!==fnGlobalObject()) {
return;
}
var fooCalled = false;
function foo(){ fooCalled = true; }
try {
this.bar( foo() );
throw new Exception("this.bar does not exist!");
$ERROR("this.bar does not exist!");
} catch(e) {
return (e instanceof TypeError) && (fooCalled===true);
}
......
......@@ -10,6 +10,7 @@ description: >
ArgumentList, in order, followed at the end by
GetValue(AssignmentExpression), which is the last item of the new
list
flags: [noStrict]
---*/
function f_arg() {
......
......@@ -10,6 +10,7 @@ description: >
ArgumentList, in order, followed at the end by
GetValue(AssignmentExpression), which is the last item of the new
list
flags: [noStrict]
---*/
function f_arg(x,y,z) {
......
......@@ -15,6 +15,7 @@ if (x !== -1) {
}
//CHECK#2
var y;
y = 1;
y *= -1;
if (y !== -1) {
......
......@@ -15,6 +15,7 @@ if (x !== 1) {
}
//CHECK#2
var y;
y = 1;
y ^= 0;
if (y !== 1) {
......
......@@ -15,6 +15,7 @@ if (x !== 1) {
}
//CHECK#2
var y;
y = 1;
y |= 0;
if (y !== 1) {
......
......@@ -15,6 +15,7 @@ if (x !== -1) {
}
//CHECK#2
var y;
y = 1;
y /= -1;
if (y !== -1) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment