Skip to content

Commit

Permalink
Tests: accept test diff
Browse files Browse the repository at this point in the history
  • Loading branch information
hhugo committed Jun 6, 2023
1 parent df82adb commit f814157
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* Compiler: fix location for parsing errors when last token is a virtual semicolon
* Compiler: fix variable renaming with nested const/let decl with identical names
* Compiler: fix variable renaming inside js method
* Compiler: consise body should allow any expression but object literals
* Compiler: preverve [new] without arguments [new C] (vs [new C()]

# 5.2.0 (2023-04-28) - Lille
## Features/Changes
Expand Down
23 changes: 21 additions & 2 deletions compiler/tests-compiler/js_parser_printer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ if(a) {
this(is, not, small) + this(is, bigger);
} |}]

let%expect_test "" =
let%expect_test "consise body can be anything that doesn't start with curly brackets" =
print
~debuginfo:false
~compact:false
Expand All @@ -618,10 +618,29 @@ let%expect_test "" =
var e = function () { } ()

var e = f(x => function () { } ())

var e = f(x => new class f {})
|};
[%expect
{|
var e = function(){}();
var e = f(x=>function(){}());
var e = f(x=>new class f{}); |}]

let%expect_test "new kw with no arguments should be preserve" =
print
~debuginfo:false
~compact:false
~report:true
{|
var e = new f
var e = new f()
var e = new class f {}
var e = new (class f {})
|};
[%expect
{|
cannot parse js (from l:4, c:31)@. |}]
var e = new f; var e = new f(); var e = new class f{}; var e = new class f{}; |}]

let%expect_test "error reporting" =
(try
Expand Down

0 comments on commit f814157

Please sign in to comment.