Skip to content

Commit

Permalink
Upgrade ocamlformat to 0.27.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbin committed Dec 3, 2024
1 parent 41be397 commit 655b5ef
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .ocamlformat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=0.26.2
version=0.27.0
profile=janestreet
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
(ocamlformat
(and
:with-dev-setup
(= 0.26.2)))
(= 0.27.0)))
(base
(and
(>= v0.17)
Expand Down
2 changes: 1 addition & 1 deletion provider-dev.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
9 changes: 6 additions & 3 deletions test/eio/test__reader.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
36 changes: 19 additions & 17 deletions test/test__cache.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand All @@ -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]
Expand Down
12 changes: 8 additions & 4 deletions test/test__extensible_variant.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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))
|}];
Expand Down Expand Up @@ -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))
|}];
Expand Down
9 changes: 6 additions & 3 deletions test/test__info.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <none>))
|}];
(* 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!"))
|}];
Expand Down
6 changes: 4 additions & 2 deletions test/test__interface.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
3 changes: 2 additions & 1 deletion test/test__introspection.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
7 changes: 4 additions & 3 deletions test/test__lookup.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions test/test__override.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 |}];
()
Expand Down

0 comments on commit 655b5ef

Please sign in to comment.