diff options
author | Matthew Olsson <matthewcolsson@gmail.com> | 2020-07-05 17:26:26 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-06 23:40:35 +0200 |
commit | 15de2eda2b8c06a59053d6a7144ea9eaf07e2210 (patch) | |
tree | 191d9459dc71e270def1ca69a02406a9498005b9 /Libraries/LibJS/Tests/operators/comma-operator.js | |
parent | 918f4affd51cdd285272770465d4d875f4ae5aa2 (diff) | |
download | serenity-15de2eda2b8c06a59053d6a7144ea9eaf07e2210.zip |
LibJS: Convert all remaining non-Array tests to the new system :)
Diffstat (limited to 'Libraries/LibJS/Tests/operators/comma-operator.js')
-rw-r--r-- | Libraries/LibJS/Tests/operators/comma-operator.js | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/Libraries/LibJS/Tests/operators/comma-operator.js b/Libraries/LibJS/Tests/operators/comma-operator.js index 549610dbe6..3b47757370 100644 --- a/Libraries/LibJS/Tests/operators/comma-operator.js +++ b/Libraries/LibJS/Tests/operators/comma-operator.js @@ -1,26 +1,24 @@ -load("test-common.js"); +test("inside parenthesis", () => { + expect((1, 2, 3)).toBe(3); + expect((1, 2 + 3, 4)).toBe(4); +}); -try { - assert((1, 2, 3) === 3); - assert((1, 2 + 3, 4) === 4); - - var foo = 0; +test("with post-increment operator", () => { + let foo = 0; foo = (foo++, foo); - assert(foo === 1); + expect(foo).toBe(1); +}); +test("with assignment operator", () => { var a, b, c; - assert(((a = b = 3), (c = 4)) === 4); - assert(a === 3); - assert(b === 3); - assert(c === 4); + expect(((a = b = 3), (c = 4))).toBe(4); + expect(a).toBe(3); + expect(b).toBe(3); + expect(c).toBe(4); var x, y, z; - assert((x = ((y = 5), (z = 6))) === 6); - assert(x === 6); - assert(y === 5); - assert(z === 6); - - console.log("PASS"); -} catch (e) { - console.log("FAIL: " + e); -} + expect((x = ((y = 5), (z = 6)))).toBe(6); + expect(x).toBe(6); + expect(y).toBe(5); + expect(z).toBe(6); +}); |