Chromium Code Reviews| Index: test/mjsunit/strict-mode.js |
| diff --git a/test/mjsunit/strict-mode.js b/test/mjsunit/strict-mode.js |
| index 20641625ab2a62d420c67b9c3fda6945d33271fb..cc757f752cb53607248ee76df9135b340195d079 100644 |
| --- a/test/mjsunit/strict-mode.js |
| +++ b/test/mjsunit/strict-mode.js |
| @@ -976,3 +976,35 @@ repeat(10, function() { testAssignToUndefined(false); }); |
| assertEquals(["c", "d", "a", "b"], strict("a", "b")); |
| assertEquals(["c", "d", "c", "d"], nonstrict("a", "b")); |
| })(); |
| + |
| + |
| +(function TestStrictFunctionPills() { |
| + function strict() { |
| + "use strict"; |
| + } |
| + assertThrows(function() { strict.caller; }, TypeError); |
| + assertThrows(function() { strict.arguments; }, TypeError); |
| + |
| + var another = new Function("'use strict'"); |
| + assertThrows(function() { another.caller; }, TypeError); |
| + assertThrows(function() { another.arguments; }, TypeError); |
| + |
|
Lasse Reichstein
2011/03/14 12:20:15
How about an inherited strictness:
var athird =
Martin Maly
2011/03/14 16:39:26
Done.
|
| + function CheckPill(pill) { |
| + assertEquals("function", typeof pill); |
| + assertInstanceof(pill, Function); |
| + assertThrows(function() { pill.property = "value"; }, TypeError); |
| + assertThrows(pill, TypeError); |
|
Lasse Reichstein
2011/03/14 12:20:15
Should you check whether it has a .prototype prope
Martin Maly
2011/03/14 16:39:26
Good suggestion. Turns out there was a bug here. A
|
| + } |
| + |
| + function CheckPillDescriptor(func, name) { |
| + var descriptor = Object.getOwnPropertyDescriptor(func, name); |
| + CheckPill(descriptor.get) |
| + CheckPill(descriptor.set); |
| + assertEquals(false, descriptor.enumerable); |
| + assertEquals(false, descriptor.configurable); |
|
Lasse Reichstein
2011/03/14 12:20:15
I think we have an assertFalse function.
Martin Maly
2011/03/14 16:39:26
Done.
|
| + } |
| + CheckPillDescriptor(strict, "caller"); |
| + CheckPillDescriptor(strict, "arguments"); |
| + CheckPillDescriptor(another, "caller"); |
| + CheckPillDescriptor(another, "arguments"); |
| +})(); |