Debian Codegraph @

js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/input/this-subclass-constructor.js

raw
1 // |reftest| skip -- legacy-regexp is not supported
2 // Copyright (C) 2020 ExE Boss. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 esid: pending
6 description: RegExp.input throws a TypeError for subclass receiver
7 info: |
8 get RegExp.input
9
10 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpInput]]).
11
12 set RegExp.input = val
13
14 1. Return ? SetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpInput]], val).
15
16 GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ).
17
18 1. Assert C is an object that has an internal slot named internalSlotName.
19 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
20 3. ...
21
22 SetLegacyRegExpStaticProperty( C, thisValue, internalSlotName, val ).
23
24 1. Assert C is an object that has an internal slot named internalSlotName.
25 2. If SameValue(C, thisValue) is false, throw a TypeError exception.
26 3. ...
27 features: [legacy-regexp,class]
28 ---*/
29
30 class MyRegExp extends RegExp {}
31
32 assert.throws(
33 TypeError,
34 function () {
35 MyRegExp.input;
36 },
37 "RegExp.input getter throws for subclass receiver"
38 );
39
40 assert.throws(
41 TypeError,
42 function () {
43 MyRegExp.input = "";
44 },
45 "RegExp.input setter throws for subclass receiver"
46 );
47
48 assert.throws(
49 TypeError,
50 function () {
51 MyRegExp.$_;
52 },
53 "RegExp.$_ getter throws for subclass receiver"
54 );
55
56 assert.throws(
57 TypeError,
58 function () {
59 MyRegExp.$_ = "";
60 },
61 "RegExp.$_ setter throws for subclass receiver"
62 );
63
64 reportCompare(0, 0);