Closed hhugo closed 2 years ago
It works if I don't emit newline in the expect test. This suggest that ppx_expect
should call open_out_bin
/open_in_bin
instead of open_out
/open_in
Indeed - the problem is that by default print_endline
also tests the underlying CRLF conversion on Windows! ocamltest contains the most extreme comparison function for this (see Filecompare.compare_text_files
in ocaml/ocaml). The central premise is that either all the newlines should be LF
or all the newlines should CRLF
but a mix (and also double-conversion CR+CRLF
) should be considered bugs, so the ocamltest function goes to great lengths to ensure that CRLF is normalised to LF exactly when all the endings are CRLF.
Digging a bit further on this issue, here is my current understanding.
The current implementation collect file offsets using fseek
and later use theses offsets to compute what lengths to read with really_input_string
. The issue is that reading is in "translated/text" mode and that reading the length between offset doesn't mean reading just the content between offset. @dra27, does that make sense ?
This seems to be fixed by 56cfa602173ff920472a5081e774ca0f84b95eec, maybe (pushed >2 weeks ago).
I'm trying to make expect_test work on windows for js_of_ocaml. Here is what I get in https://github.com/ocsigen/js_of_ocaml/pull/1132
using
ppx_expect.v0.14.1
,ppx_inline_test.v0.14.1
cat debug-expect/dune
cat debug-expect/debug_expect.ml