mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 22:28:12 +00:00
LibJS: Adding two values should convert them to primitives first
This commit is contained in:
parent
63499c2c9f
commit
fa30355194
3 changed files with 26 additions and 3 deletions
12
Libraries/LibJS/Tests/add-values-to-primitive.js
Normal file
12
Libraries/LibJS/Tests/add-values-to-primitive.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
load("test-common.js");
|
||||
|
||||
try {
|
||||
// Note that these will give different results in the REPL due to parsing behavior.
|
||||
assert([] + [] === "");
|
||||
assert([] + {} === "[object Object]");
|
||||
assert({} + {} === "[object Object][object Object]");
|
||||
assert({} + [] === "[object Object]");
|
||||
console.log("PASS");
|
||||
} catch (e) {
|
||||
console.log("FAIL: " + e);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue