Skip to content

Commit d633724

Browse files
Normalize CRLF
1 parent 4c2f6c6 commit d633724

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/test_write.ml

+6-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ let to_string_tests =
1616
fun () -> test ~suf:"" Fixtures.json_string );
1717
]
1818

19+
let replace_crlf s =
20+
(* a bit hacky as it will just remove \r even when not \r\n *)
21+
let parts = String.split_on_char '\r' s in
22+
String.concat "" parts
23+
1924
let to_file_tests =
2025
let test ?suf expected =
2126
let output_file = Filename.temp_file "test_yojson_to_file" ".json" in
@@ -25,7 +30,7 @@ let to_file_tests =
2530
let length = in_channel_length ic in
2631
let s = really_input_string ic length in
2732
close_in ic;
28-
s
33+
replace_crlf s
2934
in
3035
Sys.remove output_file;
3136
Alcotest.(check string) __LOC__ expected file_content

0 commit comments

Comments
 (0)