mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:47:35 +00:00
LibJS: Add String.prototype.includes
This commit is contained in:
parent
4a37362249
commit
838127df35
3 changed files with 48 additions and 0 deletions
18
Libraries/LibJS/Tests/String.prototype.includes.js
Normal file
18
Libraries/LibJS/Tests/String.prototype.includes.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
load("test-common.js");
|
||||
|
||||
try {
|
||||
assert(String.prototype.includes.length === 1);
|
||||
|
||||
assert("hello friends".includes("hello") === true);
|
||||
assert("hello friends".includes("hello", 100) === false);
|
||||
assert("hello friends".includes("hello", -10) === true);
|
||||
assert("hello friends".includes("friends", 6) === true);
|
||||
assert("hello friends".includes("hello", 6) === false);
|
||||
assert("hello friends false".includes(false) === true);
|
||||
assert("hello 10 friends".includes(10) === true);
|
||||
assert("hello friends undefined".includes() === true);
|
||||
|
||||
console.log("PASS");
|
||||
} catch (err) {
|
||||
console.log("FAIL: " + err);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue