diff options
Diffstat (limited to 'deps/v8/test/mjsunit/regexp-no-linear-flag.js')
-rw-r--r-- | deps/v8/test/mjsunit/regexp-no-linear-flag.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/regexp-no-linear-flag.js b/deps/v8/test/mjsunit/regexp-no-linear-flag.js new file mode 100644 index 0000000000..7df34aa830 --- /dev/null +++ b/deps/v8/test/mjsunit/regexp-no-linear-flag.js @@ -0,0 +1,22 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax +// Flags: --no-enable-experimental-regexp-engine + +// We shouldn't recognize the 'l' flag. +assertThrows(() => new RegExp("asdf", "l"), SyntaxError) +assertThrows(() => new RegExp("123|xyz", "l"), SyntaxError) +assertThrows(() => new RegExp("((a*)*)*", "yls"), SyntaxError) +assertThrows(() => new RegExp("((a*)*)*\1", "l"), SyntaxError) + +// RegExps shouldn't have a 'linear' property. +assertFalse(RegExp.prototype.hasOwnProperty('linear')); +assertFalse(/123/.hasOwnProperty('linear')); + +{ + let re = /./; + re.linear = true; + assertEquals("", re.flags); +} |