mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:37:43 +00:00
LibJS: Add String.prototype.concat
This commit is contained in:
parent
e72a537033
commit
7725b1970e
3 changed files with 42 additions and 0 deletions
22
Libraries/LibJS/Tests/String.prototype.concat.js
Normal file
22
Libraries/LibJS/Tests/String.prototype.concat.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
load("test-common.js");
|
||||
|
||||
try {
|
||||
assert(String.prototype.concat.length === 1);
|
||||
assert("".concat(1) === "1");
|
||||
assert("".concat(3,2,1) === "321");
|
||||
assert("hello".concat(" ", "friends") === "hello friends");
|
||||
assert("".concat(null) === "null");
|
||||
assert("".concat(false) === "false");
|
||||
assert("".concat(true) === "true");
|
||||
assert("".concat([]) === "");
|
||||
assert("".concat([1, 2, 3, 'hello']) === "1,2,3,hello");
|
||||
assert("".concat(true, []) === "true");
|
||||
assert("".concat(true, false) === "truefalse");
|
||||
assert("".concat({}) === "[object Object]");
|
||||
assert("".concat(1, {}) === "1[object Object]");
|
||||
assert("".concat(1, {}, false) === "1[object Object]false");
|
||||
|
||||
console.log("PASS");
|
||||
} catch (err) {
|
||||
console.log("FAIL: " + err);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue