From fa303551946ed1729a22ebeee3202f31c81bbb1d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 15 Apr 2020 09:32:44 +0200 Subject: LibJS: Adding two values should convert them to primitives first --- Libraries/LibJS/Tests/add-values-to-primitive.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Libraries/LibJS/Tests/add-values-to-primitive.js (limited to 'Libraries/LibJS/Tests/add-values-to-primitive.js') 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); +} -- cgit v1.2.3