haikuwebkit/LayoutTests/js/regexp-old-regexp-new-flags...

22 lines
677 B
Plaintext
Raw Permalink Normal View History

[ES6] Allow RegExp constructor to take pattern from an existing RegExp with new flags https://bugs.webkit.org/show_bug.cgi?id=155315 Reviewed by Saam Barati. Source/JavaScriptCore: Changed to comply with section 21.2.3.1, step 5. Eliminated syntax error. In the process, change to get the VM at the top of the function. Updated tests accordingly. * runtime/RegExpConstructor.cpp: (JSC::constructRegExp): * tests/es6.yaml: Changed miscellaneous_RegExp_constructor_can_alter_flags.js to normal. * tests/mozilla/mozilla-tests.yaml: Disabled ecma_3/RegExp/15.10.4.1-5-n.js as it checks for the old behavior of throwing a syntax error. LayoutTests: New and updated test for change. * fast/regex/constructor-expected.txt: * fast/regex/script-tests/constructor.js: Changed test for new behavior.` * js/regexp-old-regexp-new-flags-expected.txt: Added. * js/regexp-old-regexp-new-flags.html: Added. * js/script-tests/regexp-old-regexp-new-flags.js: Added. New test. * sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.3/S15.10.3.1_A2_T1-expected.txt: Removed. * sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.3/S15.10.3.1_A2_T1.html: Removed. * sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.3/S15.10.3.1_A2_T2-expected.txt: Removed. * sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.3/S15.10.3.1_A2_T2.html: Removed. * sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A2_T1-expected.txt: Removed. * sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A2_T1.html: Removed. * sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A2_T2-expected.txt: Removed. * sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A2_T2.html: Removed. * sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A8_T8-expected.txt: Removed. * sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A8_T8.html: Removed. Removed obsolete tests. Canonical link: https://commits.webkit.org/173429@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197962 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-10 23:38:15 +00:00
Test for ES6 RegExp construct a new RegExp from exiting RegExp pattern and new flags
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS re.test(" Abc ") is true
PASS re.flags is ""
PASS re.test(" ABC ") is true
PASS re.flags is "i"
PASS re.test(" Abc ") is true
PASS re.flags is ""
PASS re.exec("abcABCAbc").toString() is "abc"
PASS re.exec("abcABCAbc").toString() is "ABC"
PASS re.exec("abcABCAbc").toString() is "Abc"
PASS re.flags is "iy"
PASS re.test("abc") is false
PASS new RegExp(re, "bad flags") threw exception SyntaxError: Invalid flags supplied to RegExp constructor..
PASS successfullyParsed is true
TEST COMPLETE