summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/comma
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/language/expressions/comma')
-rw-r--r--js/src/tests/test262/language/expressions/comma/S11.14_A1.js63
-rw-r--r--js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T1.js53
-rw-r--r--js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T2.js21
-rw-r--r--js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T3.js21
-rw-r--r--js/src/tests/test262/language/expressions/comma/S11.14_A3.js38
-rw-r--r--js/src/tests/test262/language/expressions/comma/browser.js0
-rw-r--r--js/src/tests/test262/language/expressions/comma/shell.js0
-rw-r--r--js/src/tests/test262/language/expressions/comma/tco-final-strict.js23
8 files changed, 219 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/comma/S11.14_A1.js b/js/src/tests/test262/language/expressions/comma/S11.14_A1.js
new file mode 100644
index 0000000000..ed057b15fd
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/comma/S11.14_A1.js
@@ -0,0 +1,63 @@
+// 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 Expression and , or between , and
+ AssignmentExpression are allowed
+es5id: 11.14_A1
+description: Checking by using eval
+---*/
+
+//CHECK#1
+if ((eval("false\u0009,\u0009true")) !== true) {
+ throw new Test262Error('#1: (false\\u0009,\\u0009true) === true');
+}
+
+//CHECK#2
+if ((eval("false\u000B,\u000Btrue")) !== true) {
+ throw new Test262Error('#2: (false\\u000B,\\u000Btrue) === true');
+}
+
+//CHECK#3
+if ((eval("false\u000C,\u000Ctrue")) !== true) {
+ throw new Test262Error('#3: (false\\u000C,\\u000Ctrue) === true');
+}
+
+//CHECK#4
+if ((eval("false\u0020,\u0020true")) !== true) {
+ throw new Test262Error('#4: (false\\u0020,\\u0020true) === true');
+}
+
+//CHECK#5
+if ((eval("false\u00A0,\u00A0true")) !== true) {
+ throw new Test262Error('#5: (false\\u00A0,\\u00A0true) === true');
+}
+
+//CHECK#6
+if ((eval("false\u000A,\u000Atrue")) !== true) {
+ throw new Test262Error('#6: (false\\u000A,\\u000Atrue) === true');
+}
+
+//CHECK#7
+if ((eval("false\u000D,\u000Dtrue")) !== true) {
+ throw new Test262Error('#7: (false\\u000D,\\u000Dtrue) === true');
+}
+
+//CHECK#8
+if ((eval("false\u2028,\u2028true")) !== true) {
+ throw new Test262Error('#8: (false\\u2028,\\u2028true) === true');
+}
+
+//CHECK#9
+if ((eval("false\u2029,\u2029true")) !== true) {
+ throw new Test262Error('#9: (false\\u2029,\\u2029true) === true');
+}
+
+
+//CHECK#10
+if ((eval("false\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029,\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029true")) !== true) {
+ throw new Test262Error('#10: (false\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029,\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029true) === true');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T1.js b/js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T1.js
new file mode 100644
index 0000000000..dae0979097
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T1.js
@@ -0,0 +1,53 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator uses GetValue
+es5id: 11.14_A2.1_T1
+description: Either Expression is not Reference or GetBase is not null
+---*/
+
+//CHECK#1
+if ((1,2) !== 2) {
+ throw new Test262Error('#1: (1,2) === 2. Actual: ' + ((1,2)));
+}
+
+//CHECK#2
+var x = 1;
+if ((x, 2) !== 2) {
+ throw new Test262Error('#2: var x = 1; (x, 2) === 2. Actual: ' + ((x, 2)));
+}
+
+//CHECK#3
+var y = 2;
+if ((1, y) !== 2) {
+ throw new Test262Error('#3: var y = 2; (1, y) === 2. Actual: ' + ((1, y)));
+}
+
+//CHECK#4
+var x = 1;
+var y = 2;
+if ((x, y) !== 2) {
+ throw new Test262Error('#4: var x = 1; var y = 2; (x, y) === 2. Actual: ' + ((x, y)));
+}
+
+//CHECK#5
+var x = 1;
+if ((x, x) !== 1) {
+ throw new Test262Error('#5: var x = 1; (x, x) === 1. Actual: ' + ((x, x)));
+}
+
+//CHECK#6
+var objectx = new Object();
+var objecty = new Object();
+objectx.prop = true;
+objecty.prop = 1.1;
+if ((objectx.prop = false, objecty.prop) !== objecty.prop) {
+ throw new Test262Error('#6: var objectx = new Object(); var objecty = new Object(); objectx.prop = true; objecty.prop = 1; (objectx.prop = false, objecty.prop) === objecty.prop. Actual: ' + ((objectx.prop = false, objecty.prop)));
+} else {
+ if (objectx.prop !== false) {
+ throw new Test262Error('#6: var objectx = new Object(); var objecty = new Object(); objectx.prop = true; objecty.prop = 1; objectx.prop = false, objecty.prop; objectx.prop === false');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T2.js b/js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T2.js
new file mode 100644
index 0000000000..ae38566aef
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T2.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator uses GetValue
+es5id: 11.14_A2.1_T2
+description: If GetBase(Expression) is null, throw ReferenceError
+---*/
+
+//CHECK#1
+try {
+ x, 1;
+ throw new Test262Error('#1.1: x, 1 throw ReferenceError. Actual: ' + (x, 1));
+}
+catch (e) {
+ if ((e instanceof ReferenceError) !== true) {
+ throw new Test262Error('#1.2: x, 1 throw ReferenceError. Actual: ' + (e));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T3.js b/js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T3.js
new file mode 100644
index 0000000000..758858f8e8
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T3.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator uses GetValue
+es5id: 11.14_A2.1_T3
+description: If GetBase(AssigmentExpression) is null, throw ReferenceError
+---*/
+
+//CHECK#1
+try {
+ 1, y;
+ throw new Test262Error('#1.1: 1, y throw ReferenceError. Actual: ' + (1, y));
+}
+catch (e) {
+ if ((e instanceof ReferenceError) !== true) {
+ throw new Test262Error('#1.2: 1, y throw ReferenceError. Actual: ' + (e));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/comma/S11.14_A3.js b/js/src/tests/test262/language/expressions/comma/S11.14_A3.js
new file mode 100644
index 0000000000..27e20205a1
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/comma/S11.14_A3.js
@@ -0,0 +1,38 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Comma Operator evaluates all Expressions and returns the last of them
+es5id: 11.14_A3
+description: Checking with "="
+---*/
+
+//CHECK#1
+var x = 0;
+var y = 0;
+var z = 0;
+if ((x = 1, y = 2, z = 3) !== 3) {
+ throw new Test262Error('#1: var x = 0; var y = 0; var z = 0; (x = 1, y = 2, z = 3) === 3. Actual: ' + ((x = 1, y = 2, z = 3)));
+}
+
+var x = 0;
+var y = 0;
+var z = 0;
+x = 1, y = 2, z = 3;
+
+//CHECK#2
+if (x !== 1) {
+ throw new Test262Error('#2: var x = 0; var y = 0; var z = 0; x = 1, y = 2, z = 3; x === 1. Actual: ' + (x));
+}
+
+//CHECK#3
+if (y !== 2) {
+ throw new Test262Error('#3: var x = 0; var y = 0; var z = 0; x = 1, y = 2, z = 3; y === 2. Actual: ' + (y));
+}
+
+//CHECK#4
+if (z !== 3) {
+ throw new Test262Error('#4: var x = 0; var y = 0; var z = 0; x = 1, y = 2, z = 3; z === 3. Actual: ' + (z));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/comma/browser.js b/js/src/tests/test262/language/expressions/comma/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/comma/browser.js
diff --git a/js/src/tests/test262/language/expressions/comma/shell.js b/js/src/tests/test262/language/expressions/comma/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/comma/shell.js
diff --git a/js/src/tests/test262/language/expressions/comma/tco-final-strict.js b/js/src/tests/test262/language/expressions/comma/tco-final-strict.js
new file mode 100644
index 0000000000..f3998eb21c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/comma/tco-final-strict.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ return 0, f(n - 1);
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);