summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRichard Davison <richard.davison1@gmail.com>2024-05-05 18:46:30 +0200
committerGitHub <noreply@github.com>2024-05-05 18:46:30 +0200
commitd9c699f528755360e32f7d2755ad3f91b575b4f9 (patch)
tree70e09a05d62afb6bc3c783285dad36820c5c8918 /tests
parent7a2c6f42d49e7a4003384cf54b187f16e64e47a1 (diff)
downloadquickjs-d9c699f528755360e32f7d2755ad3f91b575b4f9.tar.gz
quickjs-d9c699f528755360e32f7d2755ad3f91b575b4f9.zip
fix class method with name get (#258)
Co-authored-by: Richard Davison <ridaviso@amazon.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_language.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/test_language.js b/tests/test_language.js
index 0e9bb31..f00c4be 100644
--- a/tests/test_language.js
+++ b/tests/test_language.js
@@ -335,6 +335,11 @@ function test_class()
assert(S.x === 42);
assert(S.y === 42);
assert(S.z === 42);
+
+ class P {
+ get = () => "123"
+ }
+ assert(new P().get() === "123");
};
function test_template()
@@ -362,8 +367,9 @@ function test_template_skip()
function test_object_literal()
{
var x = 0, get = 1, set = 2; async = 3;
- a = { get: 2, set: 3, async: 4 };
- assert(JSON.stringify(a), '{"get":2,"set":3,"async":4}');
+ a = { get: 2, set: 3, async: 4, get a(){ return this.get} };
+ assert(JSON.stringify(a), '{"get":2,"set":3,"async":4,"a":2}');
+ assert(a.a === 2);
a = { x, get, set, async };
assert(JSON.stringify(a), '{"x":0,"get":1,"set":2,"async":3}');