From 655b5ef9adb68dd177d763433dbefc2b49ce4a52 Mon Sep 17 00:00:00 2001 From: Mathieu Barbin Date: Tue, 3 Dec 2024 18:44:21 +0100 Subject: [PATCH] Upgrade ocamlformat to 0.27.0 --- .ocamlformat | 2 +- dune-project | 2 +- provider-dev.opam | 2 +- test/eio/test__reader.ml | 9 +++++--- test/test__cache.ml | 36 +++++++++++++++++--------------- test/test__extensible_variant.ml | 12 +++++++---- test/test__info.ml | 9 +++++--- test/test__interface.ml | 6 ++++-- test/test__introspection.ml | 3 ++- test/test__lookup.ml | 7 ++++--- test/test__override.ml | 6 ++++-- 11 files changed, 56 insertions(+), 38 deletions(-) diff --git a/.ocamlformat b/.ocamlformat index 80df8ee..04d5660 100644 --- a/.ocamlformat +++ b/.ocamlformat @@ -1,2 +1,2 @@ -version=0.26.2 +version=0.27.0 profile=janestreet diff --git a/dune-project b/dune-project index 2181666..7fde8c6 100644 --- a/dune-project +++ b/dune-project @@ -89,7 +89,7 @@ (ocamlformat (and :with-dev-setup - (= 0.26.2))) + (= 0.27.0))) (base (and (>= v0.17) diff --git a/provider-dev.opam b/provider-dev.opam index 9dc1320..71b5c1c 100644 --- a/provider-dev.opam +++ b/provider-dev.opam @@ -11,7 +11,7 @@ bug-reports: "https://github.com/mbarbin/provider/issues" depends: [ "dune" {>= "3.16"} "ocaml" {>= "5.2"} - "ocamlformat" {with-dev-setup & = "0.26.2"} + "ocamlformat" {with-dev-setup & = "0.27.0"} "base" {>= "v0.17" & < "v0.18"} "bisect_ppx" {with-dev-setup & >= "2.8.3"} "eio" {>= "1.0"} diff --git a/test/eio/test__reader.ml b/test/eio/test__reader.ml index 0e1f7d4..4cf7204 100644 --- a/test/eio/test__reader.ml +++ b/test/eio/test__reader.ml @@ -87,14 +87,16 @@ let%expect_test "test" = Eio.Path.save ~create:(`Or_truncate 0o600) Eio.Path.(Eio.Stdenv.fs env / dir / "a.txt") - (String.strip {| + (String.strip + {| Hello file a With multiple lines |}); Eio.Path.save ~create:(`Or_truncate 0o600) Eio.Path.(Eio.Stdenv.fs env / dir / "b.txt") - (String.strip {| + (String.strip + {| Hello file b With even more lines @@ -104,7 +106,8 @@ With even more print_all_text_files eio_reader ~path:dir; [%expect {| (a.txt b.txt) |}]; print_all_text_files_with_lines eio_reader ~path:dir; - [%expect {| + [%expect + {| ((file a.txt) (lines 2)) ((file b.txt) diff --git a/test/test__cache.ml b/test/test__cache.ml index 36aa634..307e048 100644 --- a/test/test__cache.ml +++ b/test/test__cache.ml @@ -15,14 +15,16 @@ end let%expect_test "override" = let num_printer = Test_providers.Num_printer.make () in let cache_state_of_uid uid = - if Provider.Trait.Uid.equal - uid - (Test_interfaces.Int_printer.Provider_interface.int_printer |> Provider.Trait.uid) + if + Provider.Trait.Uid.equal + uid + (Test_interfaces.Int_printer.Provider_interface.int_printer |> Provider.Trait.uid) then Cache_state.Int_printer - else if Provider.Trait.Uid.equal - uid - (Test_interfaces.Float_printer.Provider_interface.float_printer - |> Provider.Trait.uid) + else if + Provider.Trait.Uid.equal + uid + (Test_interfaces.Float_printer.Provider_interface.float_printer + |> Provider.Trait.uid) then Cache_state.Float_printer else assert false [@coverage off] in @@ -42,11 +44,11 @@ let%expect_test "override" = let (Provider.T { t = _; provider }) = num_printer in let int_printer_lookup () = (fun (type a) (provider : (a, _) Provider.t) -> - ignore - (Provider.lookup - provider - ~trait:Test_interfaces.Int_printer.Provider_interface.int_printer - : (module Test_interfaces.Int_printer.Provider_interface.S with type t = a))) + ignore + (Provider.lookup + provider + ~trait:Test_interfaces.Int_printer.Provider_interface.int_printer + : (module Test_interfaces.Int_printer.Provider_interface.S with type t = a))) provider; require_equal [%here] @@ -56,11 +58,11 @@ let%expect_test "override" = in let float_printer_lookup () = (fun (type a) (provider : (a, _) Provider.t) -> - ignore - (Provider.lookup - provider - ~trait:Test_interfaces.Float_printer.Provider_interface.float_printer - : (module Test_interfaces.Float_printer.Provider_interface.S with type t = a))) + ignore + (Provider.lookup + provider + ~trait:Test_interfaces.Float_printer.Provider_interface.float_printer + : (module Test_interfaces.Float_printer.Provider_interface.S with type t = a))) provider; require_equal [%here] diff --git a/test/test__extensible_variant.ml b/test/test__extensible_variant.ml index 92274ea..8cb226f 100644 --- a/test/test__extensible_variant.ml +++ b/test/test__extensible_variant.ml @@ -22,12 +22,14 @@ let%expect_test "Eq_opt at runtime" = print_s [%sexp { is_int : bool; value = (Obj.obj obj : int) }] in test (Obj.repr Eq_opt.Equal); - [%expect {| + [%expect + {| ((is_int true) (value 0)) |}]; test (Obj.repr Eq_opt.Not_equal); - [%expect {| + [%expect + {| ((is_int true) (value 1)) |}]; @@ -57,12 +59,14 @@ let () = let%expect_test "extension_constructor" = print_s [%sexp (Provider.Trait.info No_arg_A.t : Provider.Trait.Info.t)]; - [%expect {| + [%expect + {| ((id #id) (name No_arg_A)) |}]; print_s [%sexp (Provider.Trait.info No_arg_B.t : Provider.Trait.Info.t)]; - [%expect {| + [%expect + {| ((id #id) (name No_arg_B)) |}]; diff --git a/test/test__info.ml b/test/test__info.ml index bda1712..7251180 100644 --- a/test/test__info.ml +++ b/test/test__info.ml @@ -13,21 +13,24 @@ let%expect_test "info" = Provider.Trait.Info.sexp_of_id (fun (_ : int) -> Sexp.Atom "#customized-id") ~f:(fun () -> print_info ()); - [%expect {| + [%expect + {| ((id #customized-id) (name )) |}]; (* It is also possible to register a name for a trait. *) let () = Provider.Trait.Info.register_name T.t ~name:"Hello Name!" in print_info (); - [%expect {| + [%expect + {| ((id #id) (name "Hello Name!")) |}]; (* The name can be changed. Whether this is desirable is up to the user. *) let () = Provider.Trait.Info.register_name T.t ~name:"Goodbye Name!" in print_info (); - [%expect {| + [%expect + {| ((id #id) (name "Goodbye Name!")) |}]; diff --git a/test/test__interface.ml b/test/test__interface.ml index 13254f4..554234f 100644 --- a/test/test__interface.ml +++ b/test/test__interface.ml @@ -12,12 +12,14 @@ let%expect_test "dedup_sorted_keep_last" = test [ 1, "a"; 1, "b" ]; [%expect {| ((1 b)) |}]; test [ 1, "a"; 2, "b" ]; - [%expect {| + [%expect + {| ((1 a) (2 b)) |}]; test [ 1, "a"; 2, "b"; 3, "c"; 3, "c'"; 4, "d"; 4, "d'"; 5, "e" ]; - [%expect {| + [%expect + {| ((1 a) (2 b) (3 c') diff --git a/test/test__introspection.ml b/test/test__introspection.ml index 31142ca..48519d8 100644 --- a/test/test__introspection.ml +++ b/test/test__introspection.ml @@ -82,7 +82,8 @@ let%expect_test "introspection" = in Ref.set_temporarily Provider.Trait.Info.sexp_of_id sexp_of_id ~f:(fun () -> print_implemented_traits int_printer; - [%expect {| + [%expect + {| (( (id 0) (name Int_printer))) diff --git a/test/test__lookup.ml b/test/test__lookup.ml index e1ca460..31a8c6a 100644 --- a/test/test__lookup.ml +++ b/test/test__lookup.ml @@ -126,7 +126,8 @@ let%expect_test "lookup" = print_s [%sexp (List.length (Provider.bindings provider) : int)]; [%expect {| 6 |}]; List.iter Tag.all ~f:(fun tag -> print_tag t ~tag); - [%expect {| + [%expect + {| A B C @@ -191,8 +192,8 @@ let%expect_test "same_trait_uids" = (* This exercises the test when the provider arrays have the same length, otherwise we skip the actual uid comparison branch. *) let same_trait_uids - (Provider.T { t = _; provider = h1 }) - (Provider.T { t = _; provider = h2 }) + (Provider.T { t = _; provider = h1 }) + (Provider.T { t = _; provider = h2 }) = print_s [%sexp (Provider.Private.same_trait_uids h1 h2 : bool)] in diff --git a/test/test__override.ml b/test/test__override.ml index 715f0cc..7fb8762 100644 --- a/test/test__override.ml +++ b/test/test__override.ml @@ -42,7 +42,8 @@ let%expect_test "override" = ((id #id) (name Float_printer))) |}]; test num_printer; - [%expect {| + [%expect + {| 1234 1234.5678 |}]; let hum_printer = Int_hum_printer.make () in @@ -54,7 +55,8 @@ let%expect_test "override" = |}]; test hum_printer; (* Now there's an additional underscore separator in '1_234'. *) - [%expect {| + [%expect + {| 1_234 1234.5678 |}]; ()