From 65888ff694ee3efab6d347d07870f396d93bc186 Mon Sep 17 00:00:00 2001 From: hugo heuzard Date: Thu, 7 Aug 2025 09:43:47 +0200 Subject: [PATCH 1/7] Tests: some windows fix --- compiler/tests-check-prim/gen_dune.ml | 1 + compiler/tests-compiler/js_parser_printer.ml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/tests-check-prim/gen_dune.ml b/compiler/tests-check-prim/gen_dune.ml index e6cd42c2e4..82d8707956 100644 --- a/compiler/tests-check-prim/gen_dune.ml +++ b/compiler/tests-check-prim/gen_dune.ml @@ -86,6 +86,7 @@ let rule bc ocaml_version os_type = let () = let versions : version list = [ `V4_14; `V5_2; `V5_3; `V5_4 ] in + set_binary_mode_out stdout true; List.iter (fun ocaml_version -> List.iter diff --git a/compiler/tests-compiler/js_parser_printer.ml b/compiler/tests-compiler/js_parser_printer.ml index 4fd903a984..403a22ad44 100644 --- a/compiler/tests-compiler/js_parser_printer.ml +++ b/compiler/tests-compiler/js_parser_printer.ml @@ -727,7 +727,7 @@ let check_vs_string s toks = then () else match s.[a] with - | ' ' | '\n' | '\t' -> space (succ a) b + | ' ' | '\n' | '\t' | '\r' -> space (succ a) b | c -> Printf.printf "pos:%d, expecting space until %d, found %C\n" a b c in let text pos str = From dc25bd42fd2013ee398e9a803a45d9c00c23e6e4 Mon Sep 17 00:00:00 2001 From: hugo heuzard Date: Thu, 7 Aug 2025 09:44:25 +0200 Subject: [PATCH 2/7] CI: no longer change git config --- .github/workflows/js_of_ocaml.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/js_of_ocaml.yml b/.github/workflows/js_of_ocaml.yml index eb1a2259bf..f62dd275fc 100644 --- a/.github/workflows/js_of_ocaml.yml +++ b/.github/workflows/js_of_ocaml.yml @@ -108,13 +108,6 @@ jobs: if: ${{ matrix.os == 'ubuntu-latest' }} run: sudo apt-get update - - name: Set git to use LF - if: ${{ matrix.os == 'windows-latest' && matrix.ocaml-compiler < 5.2 }} - run: | - git config --global core.autocrlf false - git config --global core.eol lf - git config --global core.ignorecase false - - name: Checkout tree uses: actions/checkout@v5 From 798473832942ab1298d8a34d15fbeead0bdbb9f2 Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Thu, 7 Aug 2025 16:09:05 +0200 Subject: [PATCH 3/7] WIP --- .github/workflows/js_of_ocaml.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/js_of_ocaml.yml b/.github/workflows/js_of_ocaml.yml index f62dd275fc..970051e8cd 100644 --- a/.github/workflows/js_of_ocaml.yml +++ b/.github/workflows/js_of_ocaml.yml @@ -149,6 +149,9 @@ jobs: # It's faster to use a cached version run: opam install --fake binaryen-bin + - run: opam pin add ppx_expect https://github.com/hhugo/ppx_expect.git#v16-win + if: contains( matrix.ocaml-compiler, '4.14') + - run: opam install . --best-effort --solver builtin-mccs+glpk if: ${{ matrix.skip-test }} From 030e5510df63daed020a6d9b18e67c6148880b23 Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Fri, 8 Aug 2025 15:07:05 +0200 Subject: [PATCH 4/7] wasm --- .github/workflows/wasm_of_ocaml.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/wasm_of_ocaml.yml b/.github/workflows/wasm_of_ocaml.yml index baeaf119ea..b7967cf1f9 100644 --- a/.github/workflows/wasm_of_ocaml.yml +++ b/.github/workflows/wasm_of_ocaml.yml @@ -66,13 +66,6 @@ jobs: if: ${{ matrix.os == 'ubuntu-latest' }} run: sudo apt-get update - - name: Set git to use LF - if: ${{ matrix.os == 'windows-latest' && matrix.ocaml-compiler < 5.2 }} - run: | - git config --global core.autocrlf false - git config --global core.eol lf - git config --global core.ignorecase false - - name: Checkout tree uses: actions/checkout@v5 with: From 8330d9e25d2e9ea833534835e899298c7ab9c5b6 Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Fri, 8 Aug 2025 15:07:10 +0200 Subject: [PATCH 5/7] fix tests --- compiler/tests-compiler/js_parser_printer.ml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/tests-compiler/js_parser_printer.ml b/compiler/tests-compiler/js_parser_printer.ml index 403a22ad44..318813b182 100644 --- a/compiler/tests-compiler/js_parser_printer.ml +++ b/compiler/tests-compiler/js_parser_printer.ml @@ -813,6 +813,11 @@ let parse_print_token ?(invalid = false) ?(extra = false) s = | true -> Printf.printf "\n%2d: " pos.Parse_info.line | false -> ()); if pos.Parse_info.line <> 0 then prev := pos.Parse_info.line; + let s = + match tok with + | T_STRING _ -> Str.global_replace (Str.regexp {|\\r\\n|}) {|\n|} s + | _ -> s + in Printf.printf "%d:%s, " pos.Parse_info.col s; loop xs in From 8d38ccd4d5e816870ba1592498892425914fbedf Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Fri, 8 Aug 2025 15:39:54 +0200 Subject: [PATCH 6/7] WIP --- compiler/tests-compiler/js_parser_printer.ml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/compiler/tests-compiler/js_parser_printer.ml b/compiler/tests-compiler/js_parser_printer.ml index 318813b182..55727541a6 100644 --- a/compiler/tests-compiler/js_parser_printer.ml +++ b/compiler/tests-compiler/js_parser_printer.ml @@ -813,11 +813,6 @@ let parse_print_token ?(invalid = false) ?(extra = false) s = | true -> Printf.printf "\n%2d: " pos.Parse_info.line | false -> ()); if pos.Parse_info.line <> 0 then prev := pos.Parse_info.line; - let s = - match tok with - | T_STRING _ -> Str.global_replace (Str.regexp {|\\r\\n|}) {|\n|} s - | _ -> s - in Printf.printf "%d:%s, " pos.Parse_info.col s; loop xs in @@ -878,12 +873,13 @@ let%expect_test "string" = 5: 4:var, 8:a, 10:=, 12:"munpi\207\128\207\128\207\128qtex", 26:;, |}] let%expect_test "multiline string" = - parse_print_token ~invalid:true {| + let clean s = Str.global_replace (Str.regexp "\n") "\n" s in + parse_print_token ~invalid:true (clean {| 42; " "; 42 -|}; +|}); [%expect {| 2: 4:42, 6:;, @@ -891,24 +887,24 @@ let%expect_test "multiline string" = 4: 5:;, 5: 4:42, 0:;, Lexer error: fake:3:5: Unexpected token ILLEGAL |}]; - parse_print_token {| + parse_print_token (clean {| 42; "\ "; 42 -|}; +|}); [%expect {| 2: 4:42, 6:;, 3: 4:" ", 4: 5:;, 5: 4:42, 0:;, |}]; - parse_print_token ~invalid:true {| + parse_print_token ~invalid:true (clean {| 42; " "; 42 -|}; +|}); [%expect {| 2: 4:42, 6:;, From 0647513720a0289ca63a521ed97b7b09bfdb150a Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Fri, 8 Aug 2025 15:40:11 +0200 Subject: [PATCH 7/7] WIP --- compiler/tests-compiler/js_parser_printer.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/tests-compiler/js_parser_printer.ml b/compiler/tests-compiler/js_parser_printer.ml index 55727541a6..042c0ca90b 100644 --- a/compiler/tests-compiler/js_parser_printer.ml +++ b/compiler/tests-compiler/js_parser_printer.ml @@ -873,7 +873,7 @@ let%expect_test "string" = 5: 4:var, 8:a, 10:=, 12:"munpi\207\128\207\128\207\128qtex", 26:;, |}] let%expect_test "multiline string" = - let clean s = Str.global_replace (Str.regexp "\n") "\n" s in + let clean s = Str.global_replace (Str.regexp "\r\n") "\n" s in parse_print_token ~invalid:true (clean {| 42; "