1
Fork 0
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:
Kesse Jones 2020-04-25 09:59:22 -03:00 committed by Andreas Kling
parent 4a37362249
commit 838127df35
3 changed files with 48 additions and 0 deletions

View 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);
}