Skip to content

Commit

Permalink
[minor] Make test_untypeast.ml more readable.
Browse files Browse the repository at this point in the history
  • Loading branch information
gasche committed Oct 31, 2024
1 parent 5f644c0 commit 3d93495
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions testsuite/tests/compiler-libs/test_untypeast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ let run s =
let pe = Parse.expression (Lexing.from_string s) in
let te = Typecore.type_expression Env.initial pe in
let ute = Untypeast.untype_expression te in
Format.asprintf "%a" Pprintast.expression ute
Format.printf "%a@." Pprintast.expression ute
;;

[%%expect{|
val run : string -> string = <fun>
val run : string -> unit = <fun>
|}];;

run {| match None with Some (Some _) -> () | _ -> () |};;

[%%expect{|
- : string = "match None with | Some (Some _) -> () | _ -> ()"
match None with | Some (Some _) -> () | _ -> ()
- : unit = ()
|}];;

(***********************************)
Expand All @@ -28,12 +29,14 @@ run {| match None with Some (Some _) -> () | _ -> () |};;
run {| fun x y z -> function w -> x y z w |};;

[%%expect{|
- : string = "fun x y z -> function | w -> x y z w"
fun x y z -> function | w -> x y z w
- : unit = ()
|}];;

(* 3-ary function returning a 1-ary function *)
run {| fun x y z -> (function w -> x y z w) |};;

[%%expect{|
- : string = "fun x y z -> (function | w -> x y z w)"
fun x y z -> (function | w -> x y z w)
- : unit = ()
|}];;

0 comments on commit 3d93495

Please sign in to comment.