No Bug - Added test for new.target in argument defautls. (rs=jorendorff)
authorEric Faust <efaustbmo@gmail.com>
Thu, 30 Jun 2016 12:54:25 -0700
changeset 328363 e5232fc114207f56fcbc2699c2d7000c31df9b53
parent 328362 98cacda13404957489e78c231779c840cd0150b3
child 328364 31935e07adf2783a0e56a5d9f332ca46be2702a8
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
milestone50.0a1
No Bug - Added test for new.target in argument defautls. (rs=jorendorff)
js/src/tests/ecma_6/Class/newTargetDefaults.js
new file mode 100644
--- /dev/null
+++ b/js/src/tests/ecma_6/Class/newTargetDefaults.js
@@ -0,0 +1,25 @@
+// Check that new.target works properly in defaults.
+
+function check(expected, actual = new.target) { assertEq(actual, expected); }
+new check(check);
+check(undefined);
+
+let evaldCheck = eval("(" + check.toString() + ")");
+new evaldCheck(evaldCheck);
+evaldCheck(undefined);
+
+function testInFunction() {
+    function checkInFunction(expected, actual = new.target) { assertEq(actual, expected); }
+    new checkInFunction(checkInFunction);
+    checkInFunction(undefined);
+
+    let evaldCheckInFunction = eval("(" + checkInFunction.toString() + ")");
+    new evaldCheckInFunction(evaldCheckInFunction);
+    evaldCheckInFunction(undefined);
+}
+
+testInFunction();
+new testInFunction();
+
+if (typeof reportCompare === 'function')
+    reportCompare(0,0,"OK");