Bug 1305566 - Add testing of names in the destructuring context to the main reserved-word/keyword test. r=test
authorJeff Walden <jwalden@mit.edu>
Fri, 09 Sep 2016 16:12:19 -0700
changeset 322536 1d430f4a563b90e12abc9145a1b95238bee6e9f4
parent 322535 6175d2094ebf7fab0c269471cbb2fe1838ff5423
child 322537 862b57ae9f3839a253bec11bab867415ccd9b5a0
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewerstest
bugs1305566
milestone52.0a1
Bug 1305566 - Add testing of names in the destructuring context to the main reserved-word/keyword test. r=test
js/src/tests/ecma_5/misc/future-reserved-words.js
--- a/js/src/tests/ecma_5/misc/future-reserved-words.js
+++ b/js/src/tests/ecma_5/misc/future-reserved-words.js
@@ -66,16 +66,46 @@ function testWord(word, expectNormal, ex
   }
   catch(e)
   {
     actual = e.name;
     status +=  ", " + e.name + ": " + e.message + " ";
   }
   assertEq(actual, expectStrict, status);
 
+  // USE AS DESTRUCTURING SHORTHAND
+
+  actual = "";
+  status = summary + ": " + word + ": destructuring shorthand";
+  try
+  {
+    eval("({ " + word + " } = 'foo');");
+    actual = "no error";
+  }
+  catch(e)
+  {
+    actual = e.name;
+    status +=  ", " + e.name + ": " + e.message + " ";
+  }
+  assertEq(actual, expectNormal, status);
+
+  actual = "";
+  status = summary + ": " + word + ": strict destructuring shorthand";
+  try
+  {
+    eval("'use strict'; ({ " + word + " } = 'foo');");
+    actual = "no error";
+  }
+  catch(e)
+  {
+    actual = e.name;
+    status +=  ", " + e.name + ": " + e.message + " ";
+  }
+  assertEq(actual, expectStrict, status);
+
   // USE IN VARIABLE DECLARATION
 
   actual = "";
   status = summary + ": " + word + ": normal var";
   try
   {
     eval("var " + word + ";");
     actual = "no error";