diff options
author | Fabrice Bellard <fabrice@bellard.org> | 2024-01-27 13:12:54 +0100 |
---|---|---|
committer | Fabrice Bellard <fabrice@bellard.org> | 2024-01-27 13:12:54 +0100 |
commit | cd666a851f14acfa08dcbf042d3993ffab968374 (patch) | |
tree | be1ccdb76b29a78890cdd9f49588393f831fe44a /tests | |
parent | 090685a8c2f82c1f060fbccfebf1d1eae6cbcbf8 (diff) | |
download | quickjs-cd666a851f14acfa08dcbf042d3993ffab968374.tar.gz quickjs-cd666a851f14acfa08dcbf042d3993ffab968374.zip |
simplified and fixed arrow function parsing (github issue #226)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_language.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_language.js b/tests/test_language.js index 65dab5f..137f1d3 100644 --- a/tests/test_language.js +++ b/tests/test_language.js @@ -558,6 +558,15 @@ function test_parse_semicolon() } } +function test_parse_arrow_function() +{ + assert(typeof eval("() => {}\n() => {}"), "function"); + assert(eval("() => {}\n+1"), 1); + assert(typeof eval("x => {}\n() => {}"), "function"); + assert(typeof eval("async () => {}\n() => {}"), "function"); + assert(typeof eval("async x => {}\n() => {}"), "function"); +} + /* optional chaining tests not present in test262 */ function test_optional_chaining() { @@ -604,3 +613,4 @@ test_argument_scope(); test_function_expr_name(); test_parse_semicolon(); test_optional_chaining(); +test_parse_arrow_function(); |