OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 the V8 project authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Flags: --harmony-generators | |
6 | |
7 function test(f) { | |
8 var cdesc = Object.getOwnPropertyDescriptor(f, "caller"); | |
9 var adesc = Object.getOwnPropertyDescriptor(f, "arguments"); | |
10 | |
11 assertFalse(cdesc.enumerable); | |
12 assertFalse(cdesc.configurable); | |
13 | |
14 assertFalse(adesc.enumerable); | |
15 assertFalse(adesc.configurable); | |
16 | |
17 assertSame(cdesc.get, cdesc.set); | |
18 assertSame(cdesc.get, adesc.get); | |
19 assertSame(cdesc.get, adesc.set); | |
20 | |
21 assertTrue(cdesc.get instanceof Function); | |
22 assertEquals(0, cdesc.get.length); | |
23 assertThrows(cdesc.get, TypeError); | |
24 | |
25 assertThrows(function() { return f.caller; }, TypeError); | |
26 assertThrows(function() { f.caller = 42; }, TypeError); | |
27 assertThrows(function() { return f.arguments; }, TypeError); | |
28 assertThrows(function() { f.arguments = 42; }, TypeError); | |
29 } | |
rossberg
2014/05/07 09:19:54
This should probably include tests to check the pr
| |
30 | |
31 function *sloppy() {} | |
32 function *strict() { "use strict"; } | |
33 | |
34 test(sloppy); | |
35 test(strict); | |
OLD | NEW |