diff options
Diffstat (limited to 'js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-subclass-constructor.js')
-rw-r--r-- | js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-subclass-constructor.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-subclass-constructor.js b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-subclass-constructor.js new file mode 100644 index 0000000000..510697fd06 --- /dev/null +++ b/js/src/tests/test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-subclass-constructor.js @@ -0,0 +1,38 @@ +// |reftest| skip -- legacy-regexp is not supported +// Copyright (C) 2020 ExE Boss. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: pending +description: RegExp.lastMatch throws a TypeError for subclass receiver +info: | + get RegExp.lastMatch + + 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpLastMatch]]). + + GetLegacyRegExpStaticProperty( C, thisValue, internalSlotName ). + + 1. Assert C is an object that has an internal slot named internalSlotName. + 2. If SameValue(C, thisValue) is false, throw a TypeError exception. + 3. ... +features: [legacy-regexp,class] +---*/ + +class MyRegExp extends RegExp {} + +assert.throws( + TypeError, + function () { + MyRegExp.lastMatch; + }, + "RegExp.lastMatch getter throws for subclass receiver" +); + +assert.throws( + TypeError, + function () { + MyRegExp["$&"]; + }, + "RegExp.$& getter throws for subclass receiver" +); + +reportCompare(0, 0); |