haikuwebkit/LayoutTests/js/regexp-flags-expected.txt

38 lines
1.5 KiB
Plaintext
Raw Permalink Normal View History

Test RegExp#flags accessor
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
property descriptor
PASS descriptor.configurable is true
PASS descriptor.enumerable is false
PASS typeof descriptor.get is 'function'
PASS descriptor.set is undefined
PASS /a/g.flags is 'g'
PASS /a/.flags is ''
PASS /a/gmi.flags is 'gim'
PASS new RegExp('a', 'gmi').flags is 'gim'
PASS flags.call(/a/ig) is 'gi'
non-object receivers
Update treatment of invoking RegExp.prototype methods on RegExp.prototype. https://bugs.webkit.org/show_bug.cgi?id=155922 Reviewed by Keith Miller. Source/JavaScriptCore: According to the TC39 committee, when invoking the following RegExp.prototype methods on the RegExp.prototype: 1. RegExp.prototype.flags yields "" 2. RegExp.prototype.global yields undefined 3. RegExp.prototype.ignoreCase yields undefined 4. RegExp.prototype.multiline yields undefined 5. RegExp.prototype.unicode yields undefined 6. RegExp.prototype.source yields "(?:)" 7. RegExp.prototype.sticky yields undefined 8. RegExp.prototype.toString() yields "/(?:)/" and RegExp.prototype is still NOT an instance of RegExp. The above behavior changes is a special dispensation applicable only to RegExp.prototype. The ES6 spec of throwing errors still applies if those methods are applied to anything = else that is not a RegExp object. * runtime/RegExpPrototype.cpp: (JSC::regExpProtoGetterGlobal): (JSC::regExpProtoGetterIgnoreCase): (JSC::regExpProtoGetterMultiline): (JSC::regExpProtoGetterSticky): (JSC::regExpProtoGetterUnicode): (JSC::regExpProtoGetterFlags): (JSC::regExpProtoGetterSource): - Implemented new behavior. * tests/es6/miscellaneous_built-in_prototypes_are_not_instances.js: (test): - Updated to match current kangax test. LayoutTests: * fast/regex/script-tests/toString.js: * fast/regex/toString-expected.txt: * ietestcenter/Javascript/15.10.7.1-1-expected.txt: * ietestcenter/Javascript/TestCases/15.10.7.1-1.js: (ES5Harness.registerTest.test): * js/kde/RegExp-expected.txt: * js/kde/script-tests/RegExp.js: * js/pic/cached-named-property-getter.html: * js/regexp-flags-expected.txt: * js/script-tests/regexp-flags.js: - updated test behaviors in some cases, and rebased results as needed. * js/regress/regexp-prototype-is-not-instance-expected.txt: Added. * js/regress/regexp-prototype-is-not-instance.html: Added. * js/regress/script-tests/regexp-prototype-is-not-instance.js: Added. - Tests new RegExp.prototype method behaviors. Canonical link: https://commits.webkit.org/174685@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199545 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-04-14 18:16:35 +00:00
PASS flags.call(undefined) threw exception TypeError: The RegExp.prototype.flags getter can only be called on an object.
PASS flags.call(null) threw exception TypeError: The RegExp.prototype.flags getter can only be called on an object.
PASS flags.call(false) threw exception TypeError: The RegExp.prototype.flags getter can only be called on an object.
PASS flags.call(true) threw exception TypeError: The RegExp.prototype.flags getter can only be called on an object.
non-regex objects
PASS flags.call({}) is ''
PASS flags.call({global: true, multiline: true, ignoreCase: true}) is 'gim'
PASS flags.call({global: 1, multiline: 0, ignoreCase: 2}) is 'gi'
PASS flags.call({ __proto__: { multiline: true } }) is 'm'
[ES6] Add support for Unicode regular expressions https://bugs.webkit.org/show_bug.cgi?id=154842 Reviewed by Filip Pizlo. Source/JavaScriptCore: Added processing of Unicode regular expressions to the Yarr interpreter. Changed parsing of regular expression patterns and PatternTerms to process characters as UChar32 in the Yarr code. The parser converts matched surrogate pairs into the appropriate Unicode character when the expression is parsed. When matching a unicode expression and reading source characters, we convert proper surrogate pair into a Unicode character and advance the source cursor, "pos", one more position. The exception to this is when we know when generating a fixed character atom that we need to match a unicode character that doesn't fit in 16 bits. The code calls this an extendedUnicodeCharacter and has a helper to determine this. Added 'u' flag and 'unicode' identifier to regular expression classes. Added an "isUnicode" parameter to YarrPattern pattern() and internal users of that function. Updated the generation of the canonicalization tables to include a new set a tables that follow the ES 6.0, 21.2.2.8.2 Step 2. Renamed the YarrCanonicalizeUCS2.* files to YarrCanonicalizeUnicode.*. Added a new Layout/js test that tests the added functionality. Updated other tests that have minor es6 unicode checks and look for valid flags. Ran the ChakraCore Unicode regular expression tests as well. * CMakeLists.txt: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: * JavaScriptCore.xcodeproj/project.pbxproj: * inspector/ContentSearchUtilities.cpp: (Inspector::ContentSearchUtilities::findMagicComment): * yarr/RegularExpression.cpp: (JSC::Yarr::RegularExpression::Private::compile): Updated use of pattern(). * runtime/CommonIdentifiers.h: * runtime/RegExp.cpp: (JSC::regExpFlags): (JSC::RegExpFunctionalTestCollector::outputOneTest): (JSC::RegExp::finishCreation): (JSC::RegExp::compile): (JSC::RegExp::compileMatchOnly): * runtime/RegExp.h: * runtime/RegExpKey.h: * runtime/RegExpPrototype.cpp: (JSC::regExpProtoFuncCompile): (JSC::flagsString): (JSC::regExpProtoGetterMultiline): (JSC::regExpProtoGetterUnicode): (JSC::regExpProtoGetterFlags): Updated for new 'y' (unicode) flag. Add check to use the interpreter for unicode regular expressions. * tests/es6.yaml: * tests/stress/static-getter-in-names.js: Updated tests for new flag and for passing the minimal es6 regular expression processing. * yarr/Yarr.h: Updated the size of information now kept for backtracking. * yarr/YarrCanonicalizeUCS2.cpp: Removed. * yarr/YarrCanonicalizeUCS2.h: Removed. * yarr/YarrCanonicalizeUCS2.js: Removed. * yarr/YarrCanonicalizeUnicode.cpp: Copied from Source/JavaScriptCore/yarr/YarrCanonicalizeUCS2.cpp. * yarr/YarrCanonicalizeUnicode.h: Copied from Source/JavaScriptCore/yarr/YarrCanonicalizeUCS2.h. (JSC::Yarr::canonicalCharacterSetInfo): (JSC::Yarr::canonicalRangeInfoFor): (JSC::Yarr::getCanonicalPair): (JSC::Yarr::isCanonicallyUnique): (JSC::Yarr::areCanonicallyEquivalent): (JSC::Yarr::rangeInfoFor): Deleted. * yarr/YarrCanonicalizeUnicode.js: Copied from Source/JavaScriptCore/yarr/YarrCanonicalizeUCS2.js. (printHeader): (printFooter): (hex): (canonicalize): (canonicalizeUnicode): (createUCS2CanonicalGroups): (createUnicodeCanonicalGroups): (cu.in.groupedCanonically.characters.sort): Deleted. (cu.in.groupedCanonically.else): Deleted. Refactored to output two sets of tables, one for UCS2 and one for Unicode. The UCS2 tables follow the legacy canonicalization rules now specified in ES 6.0, 21.2.2.8.2 Step 3. The new Unicode tables follow the rules specified in ES 6.0, 21.2.2.8.2 Step 2. Eliminated the unused Latin1 tables. * yarr/YarrInterpreter.cpp: (JSC::Yarr::Interpreter::InputStream::InputStream): (JSC::Yarr::Interpreter::InputStream::readChecked): (JSC::Yarr::Interpreter::InputStream::readSurrogatePairChecked): (JSC::Yarr::Interpreter::InputStream::reread): (JSC::Yarr::Interpreter::InputStream::prev): (JSC::Yarr::Interpreter::testCharacterClass): (JSC::Yarr::Interpreter::checkCharacter): (JSC::Yarr::Interpreter::checkSurrogatePair): (JSC::Yarr::Interpreter::checkCasedCharacter): (JSC::Yarr::Interpreter::tryConsumeBackReference): (JSC::Yarr::Interpreter::backtrackPatternCharacter): (JSC::Yarr::Interpreter::matchCharacterClass): (JSC::Yarr::Interpreter::backtrackCharacterClass): (JSC::Yarr::Interpreter::matchParenthesesTerminalEnd): (JSC::Yarr::Interpreter::matchDisjunction): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::assertionWordBoundary): (JSC::Yarr::ByteCompiler::atomPatternCharacter): * yarr/YarrInterpreter.h: (JSC::Yarr::ByteTerm::ByteTerm): (JSC::Yarr::BytecodePattern::BytecodePattern): * yarr/YarrJIT.cpp: (JSC::Yarr::YarrGenerator::optimizeAlternative): (JSC::Yarr::YarrGenerator::matchCharacterClassRange): (JSC::Yarr::YarrGenerator::matchCharacterClass): (JSC::Yarr::YarrGenerator::notAtEndOfInput): (JSC::Yarr::YarrGenerator::jumpIfCharNotEquals): (JSC::Yarr::YarrGenerator::generatePatternCharacterOnce): (JSC::Yarr::YarrGenerator::generatePatternCharacterFixed): (JSC::Yarr::YarrGenerator::generatePatternCharacterGreedy): (JSC::Yarr::YarrGenerator::backtrackPatternCharacterNonGreedy): * yarr/YarrParser.h: (JSC::Yarr::Parser::CharacterClassParserDelegate::atomPatternCharacter): (JSC::Yarr::Parser::Parser): (JSC::Yarr::Parser::parseEscape): (JSC::Yarr::Parser::consumePossibleSurrogatePair): (JSC::Yarr::Parser::parseCharacterClass): (JSC::Yarr::Parser::parseTokens): (JSC::Yarr::Parser::parse): (JSC::Yarr::Parser::atEndOfPattern): (JSC::Yarr::Parser::patternRemaining): (JSC::Yarr::Parser::peek): (JSC::Yarr::parse): * yarr/YarrPattern.cpp: (JSC::Yarr::CharacterClassConstructor::CharacterClassConstructor): (JSC::Yarr::CharacterClassConstructor::append): (JSC::Yarr::CharacterClassConstructor::putChar): (JSC::Yarr::CharacterClassConstructor::putUnicodeIgnoreCase): (JSC::Yarr::CharacterClassConstructor::putRange): (JSC::Yarr::CharacterClassConstructor::charClass): (JSC::Yarr::CharacterClassConstructor::addSorted): (JSC::Yarr::CharacterClassConstructor::addSortedRange): (JSC::Yarr::YarrPatternConstructor::YarrPatternConstructor): (JSC::Yarr::YarrPatternConstructor::assertionWordBoundary): (JSC::Yarr::YarrPatternConstructor::atomPatternCharacter): (JSC::Yarr::YarrPatternConstructor::atomCharacterClassBegin): (JSC::Yarr::YarrPatternConstructor::atomCharacterClassAtom): (JSC::Yarr::YarrPatternConstructor::atomCharacterClassRange): (JSC::Yarr::YarrPatternConstructor::setupAlternativeOffsets): (JSC::Yarr::YarrPattern::compile): (JSC::Yarr::YarrPattern::YarrPattern): * yarr/YarrPattern.h: (JSC::Yarr::CharacterRange::CharacterRange): (JSC::Yarr::CharacterClass::CharacterClass): (JSC::Yarr::PatternTerm::PatternTerm): (JSC::Yarr::YarrPattern::reset): * yarr/YarrSyntaxChecker.cpp: (JSC::Yarr::SyntaxChecker::assertionBOL): (JSC::Yarr::SyntaxChecker::assertionEOL): (JSC::Yarr::SyntaxChecker::assertionWordBoundary): (JSC::Yarr::SyntaxChecker::atomPatternCharacter): (JSC::Yarr::SyntaxChecker::atomBuiltInCharacterClass): (JSC::Yarr::SyntaxChecker::atomCharacterClassBegin): (JSC::Yarr::SyntaxChecker::atomCharacterClassAtom): (JSC::Yarr::checkSyntax): LayoutTests: Added a new test for the added unicode regular expression processing. Updated several tests for the y flag changes and "unicode" property. * js/regexp-unicode-expected.txt: Added. * js/regexp-unicode.html: Added. * js/script-tests/regexp-unicode.js: Added. New test. * js/Object-getOwnPropertyNames-expected.txt: * js/regexp-flags-expected.txt: * js/script-tests/Object-getOwnPropertyNames.js: * js/script-tests/regexp-flags.js: (RegExp.prototype.hasOwnProperty): Updated tests. Canonical link: https://commits.webkit.org/172980@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197426 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-02 00:39:01 +00:00
unicode flag
PASS /a/uimg.flags is 'gimu'
PASS new RegExp('a', 'uimg').flags is 'gimu'
PASS flags.call({global: true, multiline: true, ignoreCase: true, unicode: true}) is 'gimu'
[ES6] Implement RegExp sticky flag and related functionality https://bugs.webkit.org/show_bug.cgi?id=155177 Reviewed by Saam Barati. Source/JavaScriptCore: Implemented the ES6 RegExp sticky functionality. There are two main behavior changes when the sticky flag is specified. 1) Matching starts at lastIndex and lastIndex is updated after the match. 2) The regular expression is only matched from the start position in the string. See ES6 section 21.2.5.2.2 for details. Changed both the Yarr interpreter and jit to not loop to the next character for sticky RegExp's. Updated RegExp exec and match, and stringProtoFuncMatch to handle lastIndex changes. Restructured the way flags are passed to and through YarrPatterns to use RegExpFlags instead of individual bools. Updated tests for 'y' flag and new behavior. * bytecode/CodeBlock.cpp: (JSC::regexpToSourceString): * inspector/ContentSearchUtilities.cpp: (Inspector::ContentSearchUtilities::findMagicComment): * runtime/CommonIdentifiers.h: * runtime/RegExp.cpp: (JSC::regExpFlags): (JSC::RegExpFunctionalTestCollector::outputOneTest): (JSC::RegExp::finishCreation): (JSC::RegExp::compile): (JSC::RegExp::compileMatchOnly): * runtime/RegExp.h: * runtime/RegExpKey.h: * runtime/RegExpObjectInlines.h: (JSC::RegExpObject::execInline): (JSC::RegExpObject::matchInline): * runtime/RegExpPrototype.cpp: (JSC::regExpProtoFuncCompile): (JSC::flagsString): (JSC::regExpProtoGetterMultiline): (JSC::regExpProtoGetterSticky): (JSC::regExpProtoGetterUnicode): * runtime/StringPrototype.cpp: (JSC::stringProtoFuncMatch): * tests/es6.yaml: * tests/stress/static-getter-in-names.js: (shouldBe): * yarr/RegularExpression.cpp: (JSC::Yarr::RegularExpression::Private::compile): * yarr/YarrInterpreter.cpp: (JSC::Yarr::Interpreter::tryConsumeBackReference): (JSC::Yarr::Interpreter::matchAssertionBOL): (JSC::Yarr::Interpreter::matchAssertionEOL): (JSC::Yarr::Interpreter::matchAssertionWordBoundary): (JSC::Yarr::Interpreter::matchDotStarEnclosure): (JSC::Yarr::Interpreter::matchDisjunction): (JSC::Yarr::Interpreter::Interpreter): (JSC::Yarr::ByteCompiler::atomPatternCharacter): * yarr/YarrInterpreter.h: (JSC::Yarr::BytecodePattern::BytecodePattern): (JSC::Yarr::BytecodePattern::estimatedSizeInBytes): (JSC::Yarr::BytecodePattern::ignoreCase): (JSC::Yarr::BytecodePattern::multiline): (JSC::Yarr::BytecodePattern::sticky): (JSC::Yarr::BytecodePattern::unicode): * yarr/YarrJIT.cpp: (JSC::Yarr::YarrGenerator::matchCharacterClass): (JSC::Yarr::YarrGenerator::jumpIfCharNotEquals): (JSC::Yarr::YarrGenerator::generateAssertionBOL): (JSC::Yarr::YarrGenerator::generateAssertionEOL): (JSC::Yarr::YarrGenerator::generatePatternCharacterOnce): (JSC::Yarr::YarrGenerator::generatePatternCharacterFixed): (JSC::Yarr::YarrGenerator::generateDotStarEnclosure): (JSC::Yarr::YarrGenerator::backtrack): * yarr/YarrPattern.cpp: (JSC::Yarr::YarrPatternConstructor::YarrPatternConstructor): (JSC::Yarr::YarrPatternConstructor::atomPatternCharacter): (JSC::Yarr::YarrPatternConstructor::setupAlternativeOffsets): (JSC::Yarr::YarrPatternConstructor::optimizeBOL): (JSC::Yarr::YarrPattern::compile): (JSC::Yarr::YarrPattern::YarrPattern): * yarr/YarrPattern.h: (JSC::Yarr::YarrPattern::reset): (JSC::Yarr::YarrPattern::nonwordcharCharacterClass): (JSC::Yarr::YarrPattern::ignoreCase): (JSC::Yarr::YarrPattern::multiline): (JSC::Yarr::YarrPattern::sticky): (JSC::Yarr::YarrPattern::unicode): LayoutTests: New and updated tests. * js/Object-getOwnPropertyNames-expected.txt: * js/regexp-flags-expected.txt: * js/regexp-sticky-expected.txt: Added. * js/regexp-sticky.html: Added. * js/script-tests/Object-getOwnPropertyNames.js: * js/script-tests/regexp-flags.js: (RegExp.prototype.hasOwnProperty): Deleted check for sticky property. * js/script-tests/regexp-sticky.js: New test. (asString): (testStickyExec): (testStickyMatch): Canonical link: https://commits.webkit.org/173344@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197869 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-09 20:11:46 +00:00
sticky flag
PASS /a/yimg.flags is 'gimy'
PASS new RegExp('a', 'yimg').flags is 'gimy'
PASS flags.call({global: true, multiline: true, ignoreCase: true, sticky: true}) is 'gimy'
PASS successfullyParsed is true
TEST COMPLETE