Skip to content

Commit 1b227bc

Browse files
committed
Add regression test for RegExp LegacyFeaturesEnabled flag.
1 parent fa886ac commit 1b227bc

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
6+
*/
7+
8+
/**
9+
* Test regexp-legacy-features behavior.
10+
*/
11+
12+
load("assert.js");
13+
14+
class MyRegExp extends RegExp {}
15+
16+
// TypeError: RegExp.prototype.compile cannot be used on subclasses of RegExp.
17+
assertThrows(() => new MyRegExp(/foo/).compile('pattern', ''), TypeError);
18+
assertThrows(() => new MyRegExp('foo').compile('pattern', ''), TypeError);

0 commit comments

Comments
 (0)