diff options
author | Andreas Kling <kling@serenityos.org> | 2020-04-15 09:32:44 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-15 09:48:25 +0200 |
commit | fa303551946ed1729a22ebeee3202f31c81bbb1d (patch) | |
tree | b41c15d1811113557aa9a737d1d58e0c2243126f /Libraries/LibJS/Tests/add-values-to-primitive.js | |
parent | 63499c2c9f95fac5fb12f727492d64575ef596f1 (diff) | |
download | serenity-fa303551946ed1729a22ebeee3202f31c81bbb1d.zip |
LibJS: Adding two values should convert them to primitives first
Diffstat (limited to 'Libraries/LibJS/Tests/add-values-to-primitive.js')
-rw-r--r-- | Libraries/LibJS/Tests/add-values-to-primitive.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Libraries/LibJS/Tests/add-values-to-primitive.js b/Libraries/LibJS/Tests/add-values-to-primitive.js new file mode 100644 index 0000000000..c42f94d4a6 --- /dev/null +++ b/Libraries/LibJS/Tests/add-values-to-primitive.js @@ -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); +} |