summaryrefslogtreecommitdiff
path: root/test/language
diff options
context:
space:
mode:
authorMike Pennisi <mike@mikepennisi.com>2017-12-10 15:49:50 -0500
committerMike Pennisi <mike@mikepennisi.com>2017-12-10 15:59:11 -0500
commit025b44f38cad299f5473a1230b54f6e2925ae948 (patch)
tree91a38bd1146a8c92627619673b71ea5627d0511f /test/language
parent8311965251953d4745aeb68c98fb71fab2eac1d0 (diff)
downloadqtdeclarative-testsuites-025b44f38cad299f5473a1230b54f6e2925ae948.tar.gz
Refactor AssignmentExpression tests for parsers
A number of tests for the parsing of the AssignmentExpression production were expressed using `eval`. This made the tests more complex than necessary, and also prevented the tests from providing value to ECMAScript parsers. Remove the use of `eval` in the relevant tests and instead express the expectations with literal source text. Remove superfluous "onlyStrict" restriction from tests by declaring the probe binding prior to assignment.
Diffstat (limited to 'test/language')
-rw-r--r--test/language/expressions/assignment/11.13.1-4-28-s.js24
-rw-r--r--test/language/expressions/assignment/11.13.1-4-29-s.js24
-rw-r--r--test/language/expressions/assignment/11.13.1-4-30-s.js17
-rw-r--r--test/language/expressions/assignment/11.13.1-4-31-s.js24
-rw-r--r--test/language/expressions/assignment/S11.13.1_A1.js62
-rw-r--r--test/language/expressions/assignment/id-arguments-strict.js16
-rw-r--r--test/language/expressions/assignment/id-eval-strict.js16
-rw-r--r--test/language/expressions/assignment/line-terminator.js18
-rw-r--r--test/language/expressions/assignment/white-space.js55
-rw-r--r--test/language/statements/variable/id-arguments-strict.js16
-rw-r--r--test/language/statements/variable/id-eval-strict.js16
11 files changed, 137 insertions, 151 deletions
diff --git a/test/language/expressions/assignment/11.13.1-4-28-s.js b/test/language/expressions/assignment/11.13.1-4-28-s.js
deleted file mode 100644
index ef1dfed23..000000000
--- a/test/language/expressions/assignment/11.13.1-4-28-s.js
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2012 Ecma International. All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/*---
-es5id: 11.13.1-4-28-s
-description: >
- Strict Mode - SyntaxError is thrown if the identifier 'eval'
- appears as the LeftHandSideExpression of simple assignment(=)
- under strict mode
-flags: [onlyStrict]
----*/
-
-function testcase() {
- var err = null;
- var blah = eval;
- try {
- eval("var eval = 20;");
- } catch (e) {
- err = e;
- }
- assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
- assert.sameValue(blah, eval, 'blah');
- }
-testcase();
diff --git a/test/language/expressions/assignment/11.13.1-4-29-s.js b/test/language/expressions/assignment/11.13.1-4-29-s.js
deleted file mode 100644
index fedd11c6f..000000000
--- a/test/language/expressions/assignment/11.13.1-4-29-s.js
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2012 Ecma International. All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/*---
-es5id: 11.13.1-4-29-s
-description: >
- Strict Mode - SyntaxError is thrown if the identifier 'arguments'
- appears as the LeftHandSideExpression of simple assignment(=)
- under strict mode
-flags: [onlyStrict]
----*/
-
-function testcase() {
- var err = null;
- var blah = arguments;
- try {
- eval("var arguments = 20;");
- } catch (e) {
- err = e;
- }
- assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
- assert.sameValue(blah, arguments, 'blah');
- }
-testcase();
diff --git a/test/language/expressions/assignment/11.13.1-4-30-s.js b/test/language/expressions/assignment/11.13.1-4-30-s.js
deleted file mode 100644
index 70cdcd0af..000000000
--- a/test/language/expressions/assignment/11.13.1-4-30-s.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) 2012 Ecma International. All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/*---
-es5id: 11.13.1-4-30-s
-description: >
- Strict Mode - SyntaxError is thrown if the identifier 'eval'
- appears as the LeftHandSideExpression (PrimaryExpression) of
- simple assignment(=) under strict mode
-flags: [onlyStrict]
----*/
-
- var blah = eval;
-assert.throws(SyntaxError, function() {
- eval("(eval) = 20;");
-});
-assert.sameValue(blah, eval, 'blah');
diff --git a/test/language/expressions/assignment/11.13.1-4-31-s.js b/test/language/expressions/assignment/11.13.1-4-31-s.js
deleted file mode 100644
index 6fc24f003..000000000
--- a/test/language/expressions/assignment/11.13.1-4-31-s.js
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2012 Ecma International. All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/*---
-es5id: 11.13.1-4-31-s
-description: >
- Strict Mode - SyntaxError is thrown if the identifier 'arguments'
- appears as the LeftHandSideExpression (PrimaryExpression) of
- simple assignment(=) under strict mode
-flags: [onlyStrict]
----*/
-
-function testcase() {
- var err = null;
- var blah = arguments;
- try {
- eval("(arguments) = 20;");
- } catch (e) {
- err = e;
- }
- assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
- assert.sameValue(blah, arguments, 'blah');
-}
-testcase();
diff --git a/test/language/expressions/assignment/S11.13.1_A1.js b/test/language/expressions/assignment/S11.13.1_A1.js
deleted file mode 100644
index 621a50150..000000000
--- a/test/language/expressions/assignment/S11.13.1_A1.js
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2009 the Sputnik authors. All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/*---
-info: >
- White Space and Line Terminator between LeftHandSideExpression and "=" or
- between "=" and AssignmentExpression are allowed
-es5id: 11.13.1_A1
-description: Checking by using eval
-flags: [noStrict]
----*/
-
-//CHECK#1
-if ((eval("x\u0009=\u0009true")) !== true) {
- $ERROR('#1: (x\\u0009=\\u0009true) === true');
-}
-
-//CHECK#2
-if ((eval("x\u000B=\u000Btrue")) !== true) {
- $ERROR('#2: (x\\u000B=\\u000Btrue) === true');
-}
-
-//CHECK#3
-if ((eval("x\u000C=\u000Ctrue")) !== true) {
- $ERROR('#3: (x\\u000C=\\u000Ctrue) === true');
-}
-
-//CHECK#4
-if ((eval("x\u0020=\u0020true")) !== true) {
- $ERROR('#4: (x\\u0020=\\u0020true) === true');
-}
-
-//CHECK#5
-if ((eval("x\u00A0=\u00A0true")) !== true) {
- $ERROR('#5: (x\\u00A0=\\u00A0true) === true');
-}
-
-//CHECK#6
-if ((eval("x\u000A=\u000Atrue")) !== true) {
- $ERROR('#6: (x\\u000A=\\u000Atrue) === true');
-}
-
-//CHECK#7
-if ((eval("x\u000D=\u000Dtrue")) !== true) {
- $ERROR('#7: (x\\u000D=\\u000Dtrue) === true');
-}
-
-//CHECK#8
-if ((eval("x\u2028=\u2028true")) !== true) {
- $ERROR('#8: (x\\u2028=\\u2028true) === true');
-}
-
-//CHECK#9
-if ((eval("x\u2029=\u2029true")) !== true) {
- $ERROR('#9: (x\\u2029=\\u2029true) === true');
-}
-
-
-//CHECK#10
-if ((eval("x\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029=\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029true")) !== true) {
- $ERROR('#10: (x\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029true) === true');
-}
diff --git a/test/language/expressions/assignment/id-arguments-strict.js b/test/language/expressions/assignment/id-arguments-strict.js
new file mode 100644
index 000000000..6425c52c3
--- /dev/null
+++ b/test/language/expressions/assignment/id-arguments-strict.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es5id: 11.13.1-4-30-s
+description: >
+ Strict Mode - SyntaxError is thrown if the identifier 'arguments' appears as
+ the LeftHandSideExpression (PrimaryExpression) of simple assignment(=).
+negative:
+ phase: early
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
+
+(arguments) = 20;
diff --git a/test/language/expressions/assignment/id-eval-strict.js b/test/language/expressions/assignment/id-eval-strict.js
new file mode 100644
index 000000000..b1ddcc19b
--- /dev/null
+++ b/test/language/expressions/assignment/id-eval-strict.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es5id: 11.13.1-4-30-s
+description: >
+ Strict Mode - SyntaxError is thrown if the identifier 'eval' appears as the
+ LeftHandSideExpression (PrimaryExpression) of simple assignment(=).
+negative:
+ phase: early
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
+
+(eval) = 20;
diff --git a/test/language/expressions/assignment/line-terminator.js b/test/language/expressions/assignment/line-terminator.js
new file mode 100644
index 000000000..61f29c1ef
--- /dev/null
+++ b/test/language/expressions/assignment/line-terminator.js
@@ -0,0 +1,18 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ White Space between LeftHandSideExpression and "=" or between "=" and
+ AssignmentExpression is allowed
+es5id: 11.13.1_A1
+---*/
+
+var x;
+
+x
+=
+true;
+
+if (x !== true) {
+ $ERROR('#6: (x\\u000A=\\u000Atrue) === true');
+}
diff --git a/test/language/expressions/assignment/white-space.js b/test/language/expressions/assignment/white-space.js
new file mode 100644
index 000000000..a9ecdc6d4
--- /dev/null
+++ b/test/language/expressions/assignment/white-space.js
@@ -0,0 +1,55 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ White Space between LeftHandSideExpression and "=" or between "=" and
+ AssignmentExpression is allowed
+es5id: 11.13.1_A1
+---*/
+
+var x;
+
+x = 'U+0009';
+if (x !== 'U+0009') {
+ $ERROR('#1: (x\\u0009=\\u0009true) === true');
+}
+
+x = 'U+000B';
+if (x !== 'U+000B') {
+ $ERROR('#2: (x\\u000B=\\u000Btrue) === true');
+}
+
+x = 'U+000C';
+if (x !== 'U+000C') {
+ $ERROR('#3: (x\\u000C=\\u000Ctrue) === true');
+}
+
+x = 'U+0020';
+if (x !== 'U+0020') {
+ $ERROR('#4: (x\\u0020=\\u0020true) === true');
+}
+
+x = 'U+00A0';
+if (x !== 'U+00A0') {
+ $ERROR('#5: (x\\u00A0=\\u00A0true) === true');
+}
+
+x = 'U+000D';
+if (x !== 'U+000D') {
+ $ERROR('#7: (x\\u000D=\\u000Dtrue) === true');
+}
+
+x
=
'U+2028';
+if (x !== 'U+2028') {
+ $ERROR('#8: (x\\u2028=\\u2028true) === true');
+}
+
+x
=
'U+2029';
+if (x !== 'U+2029') {
+ $ERROR('#9: (x\\u2029=\\u2029true) === true');
+}
+
+x   

=   

'U+0009U+000BU+000CU+0020U+00A0U+000DU+2028U+2029';
+if (x !== 'U+0009U+000BU+000CU+0020U+00A0U+000DU+2028U+2029') {
+ $ERROR('#10: (x\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000D\\u2028\\u2029=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000D\\u2028\\u2029true) === true');
+}
diff --git a/test/language/statements/variable/id-arguments-strict.js b/test/language/statements/variable/id-arguments-strict.js
new file mode 100644
index 000000000..66e099ef0
--- /dev/null
+++ b/test/language/statements/variable/id-arguments-strict.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es5id: 11.13.1-4-28-s
+description: >
+ Strict Mode - SyntaxError is thrown if the identifier 'arguments' appears
+ as the LeftHandSideExpression of simple assignment(=) under strict mode
+negative:
+ phase: early
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
+
+var arguments;
diff --git a/test/language/statements/variable/id-eval-strict.js b/test/language/statements/variable/id-eval-strict.js
new file mode 100644
index 000000000..a9e6c4825
--- /dev/null
+++ b/test/language/statements/variable/id-eval-strict.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es5id: 11.13.1-4-28-s
+description: >
+ Strict Mode - SyntaxError is thrown if the identifier 'eval' appears as the
+ LeftHandSideExpression of simple assignment(=) under strict mode
+negative:
+ phase: early
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
+
+var eval;