haikuwebkit/LayoutTests/js/string-includes-expected.txt

152 lines
6.8 KiB
Plaintext
Raw Permalink Normal View History

This test checks the ES6 string functions startsWith(), endsWith(), and includes().
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS String.prototype.includes.name is 'includes'
PASS String.prototype.includes.length is 1
PASS 'foo bar'.includes('bar') is true
PASS 'foo bar'.includes('bar', 4) is true
PASS 'foo bar'.includes('ar', 5) is true
PASS 'foo bar'.includes('qux') is false
PASS 'foo bar'.includes('foo') is true
PASS 'foo bar'.includes('foo', 0) is true
PASS 'foo bar'.includes('foo', -1) is true
PASS 'foo bar'.includes('') is true
PASS 'foo bar'.includes() is false
PASS 'foo bar qux'.includes('qux', 7) is true
PASS 'foo bar qux'.includes('bar', 7) is false
PASS 'foo null bar'.includes() is false
PASS 'foo null bar'.includes(null) is true
PASS 'foo null bar'.includes(null) is true
PASS 'foo undefined bar'.includes() is true
PASS 'foo undefined bar'.includes(undefined) is true
PASS 'foo undefined bar'.includes() is true
PASS 'foo undefined bar'.includes() is true
PASS 'foo true bar'.includes(true) is true
PASS 'foo false bar'.includes(false) is true
PASS 'foo 1 bar'.includes(1) is true
PASS 'foo 1.1 bar'.includes(1.1) is true
PASS 'foo NaN bar'.includes(NaN) is true
PASS 'foo 1.0 bar'.includes(1.0) is true
PASS 'foo 1e+100 bar'.includes(1e+100) is true
PASS 'foo 1e100 bar'.includes(1e100) is false
PASS 'フーバー'.includes('ーバ') is true
PASS 'フーバー'.includes('クー') is false
PASS 'abc'.includes('a', 'abc'.length) is false
PASS 'abc'.includes('a', Math.pow(2, 33)) is false
PASS 'abc'.includes('a', Infinity) is false
PASS 'abc'.includes('ab', -Infinity) is true
PASS 'abc'.includes('cd', -Infinity) is false
PASS 'abc'.includes('ab', 0) is true
PASS 'abc'.includes('cd', 0) is false
PASS String.prototype.startsWith.name is 'startsWith'
PASS String.prototype.startsWith.length is 1
PASS 'foo bar'.startsWith('foo') is true
PASS 'foo bar'.startsWith('foo', 0) is true
PASS 'foo bar'.startsWith('foo', -1) is true
PASS 'foo bar'.startsWith('oo', 1) is true
PASS 'foo bar'.startsWith('qux') is false
PASS 'foo bar'.startsWith('') is true
PASS 'foo bar'.startsWith() is false
PASS 'null'.startsWith() is false
PASS 'null'.startsWith(null) is true
PASS 'null bar'.startsWith(null) is true
PASS 'undefined'.startsWith() is true
PASS 'undefined'.startsWith(undefined) is true
PASS 'undefined bar'.startsWith() is true
PASS 'undefined bar'.startsWith() is true
PASS 'true bar'.startsWith(true) is true
PASS 'false bar'.startsWith(false) is true
PASS '1 bar'.startsWith(1) is true
PASS '1.1 bar'.startsWith(1.1) is true
PASS 'NaN bar'.startsWith(NaN) is true
PASS '1e+100 bar'.startsWith(1e+100) is true
PASS '1e100 bar'.startsWith(1e100) is false
PASS 'フーバー'.startsWith('フー') is true
PASS 'フーバー'.startsWith('バー') is false
Regression(r173761): ASSERTION FAILED: !is8Bit() in StringImpl::characters16() https://bugs.webkit.org/show_bug.cgi?id=142350 Patch by Chris Dumez <cdumez@apple.com> on 2015-03-05 Reviewed by Michael Saboff and Benjamin Poulain. Source/JavaScriptCore: Call WTFString::hasInfixStartingAt() / hasInfixEndingAt() now that these methods have been renamed for clarity. * runtime/StringPrototype.cpp: (JSC::stringProtoFuncStartsWith): (JSC::stringProtoFuncEndsWith): Source/WTF: Fix ASSERTION FAILED: !is8Bit() in StringImpl::characters16() from WTF::equalInner() after r173761. The code was incorrectly assuming that if stringImpl is 16-bit, then matchString is 16-bit too, which is not correct. Also rename WTFString::startsWith() / endsWith() taking an offset to hasInfixStartingAt() / hasInfixEndingAt() for clarity. It seems odd to call it startsWith even though it won't technically *start* with the pattern if the input offset is greater than zero. Also drop the caseSensitive argument as it is never used (always true at call sites. * wtf/text/StringImpl.cpp: (WTF::equalInner): (WTF::StringImpl::hasInfixStartingAt): (WTF::StringImpl::hasInfixEndingAt): (WTF::StringImpl::startsWith): Deleted. (WTF::StringImpl::endsWith): Deleted. * wtf/text/StringImpl.h: * wtf/text/WTFString.h: (WTF::String::hasInfixStartingAt): (WTF::String::hasInfixEndingAt): (WTF::String::startsWith): Deleted. (WTF::String::endsWith): Deleted. Tools: Add API test for WTFString::hasInfixStartingAt() to make sure it doesn't crash if the string is 8-bit but the pattern is 16-bit (and vice-versa). * TestWebKitAPI/Tests/WTF/WTFString.cpp: (TestWebKitAPI::TEST): LayoutTests: Update String.startsWith() / endsWith() test to cover cases where the input string is 8-bit and the pattern is 16-bit, and vice-versa. * js/script-tests/string-includes.js: * js/string-includes-expected.txt: Canonical link: https://commits.webkit.org/160395@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181105 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-05 23:34:56 +00:00
PASS 'フーバー'.startsWith('abc') is false
PASS 'フーバー'.startsWith('abc', 1) is false
PASS 'foo bar'.startsWith('フー') is false
PASS 'foo bar'.startsWith('フー', 1) is false
PASS 'abc'.startsWith('a', Infinity) is false
PASS 'abc'.startsWith('a', 1) is false
PASS 'abc'.startsWith('b', 1) is true
PASS 'abc'.startsWith('b', 2) is false
PASS 'abc'.startsWith('c', 2) is true
PASS 'abc'.startsWith('a', Math.pow(2, 33)) is false
PASS String.prototype.endsWith.name is 'endsWith'
PASS String.prototype.endsWith.length is 1
PASS 'foo bar'.endsWith('bar') is true
PASS 'foo bar'.endsWith('ba', 6) is true
PASS 'foo bar'.endsWith(' ba', 6) is true
PASS 'foo bar'.endsWith('foo bar') is true
PASS 'foo bar'.endsWith('foo bar', 7) is true
PASS 'foo bar'.endsWith('foo bar', 8) is true
PASS 'foo bar'.endsWith('foo bar', -1) is false
PASS 'foo bar'.endsWith('qux') is false
PASS 'foo bar'.endsWith('') is true
PASS 'foo bar'.endsWith() is false
PASS 'foo null'.endsWith() is false
PASS 'foo null'.endsWith(null) is true
PASS 'foo null'.endsWith(null) is true
PASS 'foo undefined'.endsWith() is true
PASS 'foo undefined'.endsWith(undefined) is true
PASS 'foo undefined'.endsWith() is true
PASS 'foo undefined'.endsWith() is true
PASS 'foo true'.endsWith(true) is true
PASS 'foo false'.endsWith(false) is true
PASS 'foo 1'.endsWith(1) is true
PASS 'foo 1.1'.endsWith(1.1) is true
PASS 'foo NaN'.endsWith(NaN) is true
PASS 'foo 1e+100'.endsWith(1e+100) is true
PASS 'foo 1e100'.endsWith(1e100) is false
PASS 'フーバー'.endsWith('バー') is true
PASS 'フーバー'.endsWith('フー') is false
Regression(r173761): ASSERTION FAILED: !is8Bit() in StringImpl::characters16() https://bugs.webkit.org/show_bug.cgi?id=142350 Patch by Chris Dumez <cdumez@apple.com> on 2015-03-05 Reviewed by Michael Saboff and Benjamin Poulain. Source/JavaScriptCore: Call WTFString::hasInfixStartingAt() / hasInfixEndingAt() now that these methods have been renamed for clarity. * runtime/StringPrototype.cpp: (JSC::stringProtoFuncStartsWith): (JSC::stringProtoFuncEndsWith): Source/WTF: Fix ASSERTION FAILED: !is8Bit() in StringImpl::characters16() from WTF::equalInner() after r173761. The code was incorrectly assuming that if stringImpl is 16-bit, then matchString is 16-bit too, which is not correct. Also rename WTFString::startsWith() / endsWith() taking an offset to hasInfixStartingAt() / hasInfixEndingAt() for clarity. It seems odd to call it startsWith even though it won't technically *start* with the pattern if the input offset is greater than zero. Also drop the caseSensitive argument as it is never used (always true at call sites. * wtf/text/StringImpl.cpp: (WTF::equalInner): (WTF::StringImpl::hasInfixStartingAt): (WTF::StringImpl::hasInfixEndingAt): (WTF::StringImpl::startsWith): Deleted. (WTF::StringImpl::endsWith): Deleted. * wtf/text/StringImpl.h: * wtf/text/WTFString.h: (WTF::String::hasInfixStartingAt): (WTF::String::hasInfixEndingAt): (WTF::String::startsWith): Deleted. (WTF::String::endsWith): Deleted. Tools: Add API test for WTFString::hasInfixStartingAt() to make sure it doesn't crash if the string is 8-bit but the pattern is 16-bit (and vice-versa). * TestWebKitAPI/Tests/WTF/WTFString.cpp: (TestWebKitAPI::TEST): LayoutTests: Update String.startsWith() / endsWith() test to cover cases where the input string is 8-bit and the pattern is 16-bit, and vice-versa. * js/script-tests/string-includes.js: * js/string-includes-expected.txt: Canonical link: https://commits.webkit.org/160395@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181105 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-03-05 23:34:56 +00:00
PASS 'フーバー'.endsWith('abc') is false
PASS 'フーバー'.endsWith('abc') is false
PASS 'foo bar'.endsWith('フー') is false
PASS 'foo bar'.endsWith('フー', 3) is false
PASS 'abc'.endsWith('bc', Infinity) is true
PASS 'abc'.endsWith('bc', Math.pow(2, 33)) is true
PASS 'abc'.endsWith('a', 0) is false
PASS 'abc'.endsWith('a', 1) is true
PASS 'abc'.endsWith('b', 1) is false
PASS 'abc'.endsWith('b', 2) is true
PASS 'abc'.endsWith('bc', 2) is false
PASS 'abc'.endsWith('bc', 3) is true
PASS (function() { var f = String.prototype.startsWith; (function() { f('a'); })(); })() threw exception TypeError: Type error.
PASS (function() { var f = String.prototype.endsWith; (function() { f('a'); })(); })() threw exception TypeError: Type error.
PASS (function() { var f = String.prototype.includes; (function() { f('a'); })(); })() threw exception TypeError: Type error.
Fix typos in our error messages and remove some trailing periods https://bugs.webkit.org/show_bug.cgi?id=155985 Reviewed by Mark Lam. Source/JavaScriptCore: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): * runtime/ArrayConstructor.h: (JSC::isArray): * runtime/ProxyConstructor.cpp: (JSC::makeRevocableProxy): (JSC::proxyRevocableConstructorThrowError): (JSC::ProxyConstructor::finishCreation): (JSC::constructProxyObject): * runtime/ProxyObject.cpp: (JSC::ProxyObject::finishCreation): (JSC::performProxyGet): (JSC::ProxyObject::performInternalMethodGetOwnProperty): (JSC::ProxyObject::performHasProperty): (JSC::ProxyObject::performPut): (JSC::performProxyCall): (JSC::performProxyConstruct): (JSC::ProxyObject::performDelete): (JSC::ProxyObject::performPreventExtensions): (JSC::ProxyObject::performIsExtensible): (JSC::ProxyObject::performDefineOwnProperty): (JSC::ProxyObject::performGetOwnPropertyNames): (JSC::ProxyObject::performSetPrototype): (JSC::ProxyObject::performGetPrototype): * runtime/StringPrototype.cpp: (JSC::stringProtoFuncStartsWith): (JSC::stringProtoFuncEndsWith): (JSC::stringProtoFuncIncludes): * runtime/Structure.cpp: (JSC::Structure::preventExtensionsTransition): * tests/stress/proxy-basic.js: * tests/stress/proxy-construct.js: (throw.new.Error): (assert): * tests/stress/proxy-define-own-property.js: (assert): (throw.new.Error): (i.catch): (assert.set get catch): * tests/stress/proxy-delete.js: (assert): * tests/stress/proxy-get-own-property.js: (assert): (i.catch): (set get let): * tests/stress/proxy-get-prototype-of.js: (assert): (assert.get let): (assert.get catch): * tests/stress/proxy-has-property.js: (assert): * tests/stress/proxy-is-array.js: (test): * tests/stress/proxy-is-extensible.js: (assert): * tests/stress/proxy-json.js: (assert): (test): * tests/stress/proxy-own-keys.js: (assert): (i.catch): * tests/stress/proxy-prevent-extensions.js: (assert): * tests/stress/proxy-property-descriptor.js: * tests/stress/proxy-revoke.js: (assert): (throw.new.Error.): (throw.new.Error): (shouldThrowNullHandler): * tests/stress/proxy-set-prototype-of.js: (assert.set let): (assert.set catch): (assert): (set catch): * tests/stress/proxy-set.js: (throw.new.Error.let.handler.set 45): (throw.new.Error): * tests/stress/proxy-with-private-symbols.js: (assert): * tests/stress/proxy-with-unbalanced-getter-setter.js: (assert): * tests/stress/reflect-set-proxy-set.js: (throw.new.Error.let.handler.set 45): (throw.new.Error): * tests/stress/reflect-set-receiver-proxy-set.js: (let.handler.set 45): (catch): * tests/stress/string-prototype-methods-endsWith-startsWith-includes-correctness.js: (test): (test.get let): LayoutTests: * js/string-includes-expected.txt: Canonical link: https://commits.webkit.org/174113@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198813 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-30 00:24:16 +00:00
PASS 'foo bar'.startsWith(/w+/) threw exception TypeError: Argument to String.prototype.startsWith cannot be a RegExp.
PASS 'foo bar'.endsWith(/w+/) threw exception TypeError: Argument to String.prototype.endsWith cannot be a RegExp.
PASS 'foo bar'.includes(/w+/) threw exception TypeError: Argument to String.prototype.includes cannot be a RegExp.
PASS stringToSearchIn.startsWith(searchString, startOffset) is true
PASS sideEffect == 'ABC' is true
PASS stringToSearchIn.startsWith(searchString, startOffset) threw exception error.
PASS sideEffect == '' is true
PASS stringToSearchIn.startsWith(searchString, startOffset) threw exception error.
PASS sideEffect == 'A' is true
PASS stringToSearchIn.startsWith(searchString, startOffset) threw exception error.
PASS sideEffect == 'AB' is true
PASS stringToSearchIn.endsWith(searchString, endOffset) is true
PASS sideEffect == 'ABC' is true
PASS stringToSearchIn.endsWith(searchString, endOffset) threw exception error.
PASS sideEffect == '' is true
PASS stringToSearchIn.endsWith(searchString, endOffset) threw exception error.
PASS sideEffect == 'A' is true
PASS stringToSearchIn.endsWith(searchString, endOffset) threw exception error.
PASS sideEffect == 'AB' is true
PASS stringToSearchIn.includes(searchString, startOffset) is true
PASS sideEffect == 'ABC' is true
PASS stringToSearchIn.includes(searchString, startOffset) threw exception error.
PASS sideEffect == '' is true
PASS stringToSearchIn.includes(searchString, startOffset) threw exception error.
PASS sideEffect == 'A' is true
PASS stringToSearchIn.includes(searchString, startOffset) threw exception error.
PASS sideEffect == 'AB' is true
PASS successfullyParsed is true
TEST COMPLETE