Skip to content

Commit c47b871

Browse files
committed
JavaScript parser: test parsing of labels
1 parent 8ba6297 commit c47b871

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

compiler/tests-compiler/js_parser_printer.ml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,3 +1035,28 @@ var y = async => async
10351035
2: 0:var, 4:y (identifier), 6:=, 8:{, 10:async, 15::, 17:35, 19:}, 0:; (virtual),
10361036
4: 0:var, 4:y (identifier), 6:=, 8:async, 14:x (identifier), 16:=>, 19:x (identifier), 0:; (virtual),
10371037
5: 0:var, 4:y (identifier), 6:=, 8:async, 14:=>, 17:async, 0:; (virtual), |}]
1038+
1039+
let%expect_test "label parsing" =
1040+
parse_print_token
1041+
~extra:true
1042+
{|
1043+
get:{of:{from:{async:{break async}break from}break of}break get}
1044+
|};
1045+
[%expect.unreachable]
1046+
[@@expect.uncaught_exn {|
1047+
(* CR expect_test_collector: This test expectation appears to contain a backtrace.
1048+
This is strongly discouraged as backtraces are fragile.
1049+
Please change this test to not include a backtrace. *)
1050+
1051+
("Js_of_ocaml_compiler.Parse_js.Parsing_error(_)")
1052+
Raised at Js_of_ocaml_compiler__Parse_js.parse_aux in file "compiler/lib/parse_js.ml", line 425, characters 6-37
1053+
Called from Js_of_ocaml_compiler__Parse_js.parse' in file "compiler/lib/parse_js.ml", line 440, characters 16-59
1054+
Called from Js_parser_printer_15__Js_parser_printer.parse_print_token in file "compiler/tests-compiler/js_parser_printer.ml", line 700, characters 8-27
1055+
Re-raised at Js_parser_printer_15__Js_parser_printer.parse_print_token in file "compiler/tests-compiler/js_parser_printer.ml", line 703, characters 6-13
1056+
Called from Js_parser_printer_15__Js_parser_printer.(fun) in file "compiler/tests-compiler/js_parser_printer.ml", line 1040, characters 2-110
1057+
Called from Expect_test_collector.Make.Instance_io.exec in file "collector/expect_test_collector.ml", line 262, characters 12-19
1058+
1059+
Trailing output
1060+
---------------
1061+
1062+
cannot parse l:2:3@. |}]

0 commit comments

Comments
 (0)