Skip to content

Commit 98a23ed

Browse files
v0.17~preview.129.15+205
1 parent 7440637 commit 98a23ed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1820
-363
lines changed

README.mdx

Lines changed: 622 additions & 0 deletions
Large diffs are not rendered by default.

README.org

Lines changed: 0 additions & 285 deletions
This file was deleted.

make-corrected-file/make_corrected_file.ml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ let f
1515
~path
1616
()
1717
=
18-
let prev_contents = Stdio.In_channel.with_file path ~f:Stdio.In_channel.input_all in
18+
let prev_contents =
19+
if Stdlib.Sys.file_exists path
20+
then Stdio.In_channel.with_file path ~f:Stdio.In_channel.input_all
21+
else ""
22+
in
1923
match String.( = ) prev_contents next_contents with
2024
| true ->
2125
(* It's possible for stale .corrected files to linger and ideally we would delete them

src/ppx_expect.ml

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -204,25 +204,28 @@ let transform_let_expect ~trailing_location ~tags ~expected_exn ~description ~lo
204204
let trailing_test_id = Expectation_id.mint () in
205205
let exn_test_id = Expectation_id.mint () in
206206
[%expr
207-
let module Ppx_expect_test_block =
208-
Ppx_expect_runtime.Make_test_block (Expect_test_config)
209-
in
210-
Ppx_expect_test_block.run_suite
211-
~filename_rel_to_project_root:[%e estring ~loc filename_rel_to_project_root]
212-
~line_number:[%e eint ~loc loc.loc_start.pos_lnum]
213-
~location:[%e Expr.compact_loc ~loc (compact_loc_of_ppxlib_location loc)]
214-
~trailing_loc:[%e Expr.compact_loc ~loc trailing_location]
215-
~body_loc:[%e Expr.compact_loc ~loc body_loc]
216-
~formatting_flexibility:[%e Expr.flexibility_of_strictness ~loc]
217-
~expected_exn:[%e Expr.(option ~loc (pair payload compact_loc)) expected_exn]
218-
~trailing_test_id:[%e Expr.id ~loc trailing_test_id]
219-
~exn_test_id:[%e Expr.id ~loc exn_test_id]
220-
~description:[%e Expr.option estring ~loc description]
221-
~tags:[%e tags |> List.map ~f:(estring ~loc) |> elist ~loc]
222-
~inline_test_config:(module Inline_test_config)
223-
~expectations:
224-
[%e Merlin_helpers.hide_expression (Expr.id_expr_alist ~loc expectations)]
225-
(fun () -> [%e body])]
207+
match Ppx_inline_test_lib.testing with
208+
| `Not_testing -> ()
209+
| `Testing _ ->
210+
let module Ppx_expect_test_block =
211+
Ppx_expect_runtime.Make_test_block (Expect_test_config)
212+
in
213+
Ppx_expect_test_block.run_suite
214+
~filename_rel_to_project_root:[%e estring ~loc filename_rel_to_project_root]
215+
~line_number:[%e eint ~loc loc.loc_start.pos_lnum]
216+
~location:[%e Expr.compact_loc ~loc (compact_loc_of_ppxlib_location loc)]
217+
~trailing_loc:[%e Expr.compact_loc ~loc trailing_location]
218+
~body_loc:[%e Expr.compact_loc ~loc body_loc]
219+
~formatting_flexibility:[%e Expr.flexibility_of_strictness ~loc]
220+
~expected_exn:[%e Expr.(option ~loc (pair payload compact_loc)) expected_exn]
221+
~trailing_test_id:[%e Expr.id ~loc trailing_test_id]
222+
~exn_test_id:[%e Expr.id ~loc exn_test_id]
223+
~description:[%e Expr.option estring ~loc description]
224+
~tags:[%e tags |> List.map ~f:(estring ~loc) |> elist ~loc]
225+
~inline_test_config:(module Inline_test_config)
226+
~expectations:
227+
[%e Merlin_helpers.hide_expression (Expr.id_expr_alist ~loc expectations)]
228+
(fun () -> [%e body])]
226229
;;
227230

228231
let let_expect_pat =

test/bad_test.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ let%expect_test (_ [@tags "no-js"]) =
3434
print_slot trace 5;
3535
[%expect
3636
{|
37-
(* expect_test_collector: This test expectation appears to contain a backtrace.
38-
This is strongly discouraged as backtraces are fragile.
39-
Please change this test to not include a backtrace. *)
37+
(* expect_test_collector: This test expectation appears to contain a backtrace.
38+
This is strongly discouraged as backtraces are fragile.
39+
Please change this test to not include a backtrace. *)
4040

41-
Raised by primitive operation at Ppx_expect_test__Bad_test.get_a_trace.loop in file "bad_test.ml", line 12, characters 17-29
41+
Raised by primitive operation at Ppx_expect_test__Bad_test.get_a_trace.loop in file "bad_test.ml", line 12, characters 17-29
4242
|}]
4343
;;

test/escaped_strings.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
let%expect_test "escaped carriage return" =
22
print_string "a\r\nb";
3-
[%expect "\na\r\nb"];
3+
[%expect " \n a\n b\n "];
44
print_string "a\r\nb";
55
[%expect_exact "a\r\nb"]
66
;;
@@ -21,7 +21,7 @@ let%expect_test "escaped quote" =
2121

2222
let%expect_test "escaped trailing carriage return" =
2323
print_string "a\r\nb\r\n";
24-
[%expect "\na\r\nb\r"];
24+
[%expect " \n a\n b\n "];
2525
print_string "a\r\nb\r\n";
2626
[%expect_exact "a\r\nb\r\n"]
2727
;;

test/example/chdir.ml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@
33
let%expect_test _ =
44
print_string "hello world\n";
55
Unix.chdir "..";
6-
[%expect {|
7-
hello world
8-
|}]
6+
[%expect {| hello world |}]
97
;;

test/example/control_chars.ml

9 Bytes
Binary file not shown.

test/example/tests.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ let%expect_test "foo" =
1010
pr (Sexp.to_string (sexp_of_t [ 1; 2; 3 ]));
1111
[%expect {|
1212
line1
13-
(1 2 3) |}]
13+
(1 2 3)
14+
|}]
1415
;;
1516

1617
let%expect_test _ =

0 commit comments

Comments
 (0)