From 586f10b6e17a36b045377988205230b29892be0f Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Sat, 17 Apr 2021 01:46:48 +0300 Subject: LibJS: Accept symbol property in the `in` operator This is used by discord.com and allowed by the specification: https://tc39.es/ecma262/#sec-relational-operators-runtime-semantics-evaluation --- Userland/Libraries/LibJS/Tests/operators/in-operator-basic.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Userland/Libraries/LibJS/Tests') diff --git a/Userland/Libraries/LibJS/Tests/operators/in-operator-basic.js b/Userland/Libraries/LibJS/Tests/operators/in-operator-basic.js index 1deec41f76..a036171c27 100644 --- a/Userland/Libraries/LibJS/Tests/operators/in-operator-basic.js +++ b/Userland/Libraries/LibJS/Tests/operators/in-operator-basic.js @@ -1,10 +1,12 @@ test("in operator with objects", () => { - const o = { foo: "bar", bar: undefined }; + const sym = Symbol(); + const o = { foo: "bar", bar: undefined, [sym]: "qux" }; expect("" in o).toBeFalse(); expect("foo" in o).toBeTrue(); expect("bar" in o).toBeTrue(); expect("baz" in o).toBeFalse(); expect("toString" in o).toBeTrue(); + expect(sym in o).toBeTrue(); }); test("in operator with arrays", () => { -- cgit v1.2.3