diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/basic/string-includes.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/basic/string-includes.js')
-rw-r--r-- | js/src/jit-test/tests/basic/string-includes.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/basic/string-includes.js b/js/src/jit-test/tests/basic/string-includes.js new file mode 100644 index 000000000..f41b0c6d7 --- /dev/null +++ b/js/src/jit-test/tests/basic/string-includes.js @@ -0,0 +1,46 @@ +assertEq("abc".includes("a"), true); +assertEq("abc".includes("b"), true); +assertEq("abc".includes("abc"), true); +assertEq("abc".includes("bc"), true); +assertEq("abc".includes("d"), false); +assertEq("abc".includes("abcd"), false); +assertEq("abc".includes("ac"), false); +assertEq("abc".includes("abc", 0), true); +assertEq("abc".includes("bc", 0), true); +assertEq("abc".includes("de", 0), false); +assertEq("abc".includes("bc", 1), true); +assertEq("abc".includes("c", 1), true); +assertEq("abc".includes("a", 1), false); +assertEq("abc".includes("abc", 1), false); +assertEq("abc".includes("c", 2), true); +assertEq("abc".includes("d", 2), false); +assertEq("abc".includes("dcd", 2), false); +assertEq("abc".includes("a", 42), false); +assertEq("abc".includes("a", Infinity), false); +assertEq("abc".includes("ab", -43), true); +assertEq("abc".includes("cd", -42), false); +assertEq("abc".includes("ab", -Infinity), true); +assertEq("abc".includes("cd", -Infinity), false); +assertEq("abc".includes("ab", NaN), true); +assertEq("abc".includes("cd", NaN), false); +var myobj = {toString : () => "abc", includes : String.prototype.includes}; +assertEq(myobj.includes("abc"), true); +assertEq(myobj.includes("cd"), false); +var gotStr = false, gotPos = false; +myobj = {toString : (function () { + assertEq(gotPos, false); + gotStr = true; + return "xyz"; +}), +includes : String.prototype.includes}; +var idx = {valueOf : (function () { + assertEq(gotStr, true); + gotPos = true; + return 42; +})}; +myobj.includes("elephant", idx); +assertEq(gotPos, true); +assertEq("xyzzy".includes("zy\0", 2), false); +var dots = Array(10000).join('.'); +assertEq(dots.includes("\x01", 10000), false); +assertEq(dots.includes("\0", 10000), false); |