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 2b209ff commit e855f49
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 33 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 @@ -39,7 +39,7 @@
(ocamlformat
(and
:with-dev-setup
(= 0.26.2)))
(= 0.27.0)))
(base
(and
(>= v0.16)
Expand Down
2 changes: 1 addition & 1 deletion loc-tests.opam
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ bug-reports: "https://github.com/mbarbin/loc/issues"
depends: [
"dune" {>= "3.16"}
"ocaml" {>= "4.14"}
"ocamlformat" {with-dev-setup & = "0.26.2"}
"ocamlformat" {with-dev-setup & = "0.27.0"}
"base" {>= "v0.16" & < "v0.18"}
"bisect_ppx" {with-dev-setup & >= "2.8.3"}
"expect_test_helpers_core" {>= "v0.16" & < "v0.18"}
Expand Down
6 changes: 4 additions & 2 deletions test/test__none.ml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ let%expect_test "offsets" =
{ start_offset = (Loc.start_offset Loc.none : int)
; stop_offset = (Loc.stop_offset Loc.none : int)
}];
[%expect {|
[%expect
{|
((start_offset 0)
(stop_offset 0))
|}];
Expand All @@ -47,7 +48,8 @@ let%expect_test "offsets" =

let%expect_test "range" =
print_s [%sexp (Loc.range Loc.none : Loc.Range.t)];
[%expect {|
[%expect
{|
((start 0)
(stop 0))
|}];
Expand Down
3 changes: 2 additions & 1 deletion test/test__of_file.ml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ let%expect_test "is_none" =

let%expect_test "range" =
print_s [%sexp (Loc.range loc : Loc.Range.t)];
[%expect {|
[%expect
{|
((start 0)
(stop 0))
|}];
Expand Down
9 changes: 6 additions & 3 deletions test/test__offset.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,20 @@ let%expect_test "of_position" =

let%expect_test "start/stop" =
print_offsets (Loc.of_position p1);
[%expect {|
[%expect
{|
((start_offset 9)
(stop_offset 9))
|}];
print_offsets (Loc.of_position p2);
[%expect {|
[%expect
{|
((start_offset 26)
(stop_offset 26))
|}];
print_offsets (Loc.create (p1, p2));
[%expect {|
[%expect
{|
((start_offset 9)
(stop_offset 26))
|}];
Expand Down
9 changes: 6 additions & 3 deletions test/test__range.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,20 @@ let%expect_test "sexp_of" =
let r2 = Loc.Range.of_positions ~start:p2 ~stop:p3 in
let r3 = Loc.Range.of_positions ~start:p1 ~stop:p3 in
print_s [%sexp (r1 : Loc.Range.t)];
[%expect {|
[%expect
{|
((start 9)
(stop 26))
|}];
print_s [%sexp (r2 : Loc.Range.t)];
[%expect {|
[%expect
{|
((start 26)
(stop 43))
|}];
print_s [%sexp (r3 : Loc.Range.t)];
[%expect {|
[%expect
{|
((start 9)
(stop 43))
|}];
Expand Down
9 changes: 6 additions & 3 deletions test/test__sexp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ let%expect_test "none" =
[%expect {| _ |}];
Ref.set_temporarily Loc.include_sexp_of_locs true ~f:(fun () ->
print_s [%sexp (loc : Loc.t)];
[%expect {|
[%expect
{|
((start <none>:1:0)
(stop <none>:1:0))
|}]);
Expand All @@ -17,7 +18,8 @@ let%expect_test "pos" =
let loc = Loc.of_pos ("fname", 1, 15, 15) in
Ref.set_temporarily Loc.include_sexp_of_locs true ~f:(fun () ->
print_s [%sexp (loc : Loc.t)];
[%expect {|
[%expect
{|
((start fname:1:15)
(stop fname:1:15))
|}]);
Expand All @@ -32,7 +34,8 @@ let%expect_test "loc" =
in
Ref.set_temporarily Loc.include_sexp_of_locs true ~f:(fun () ->
print_s [%sexp (loc : Loc.t)];
[%expect {|
[%expect
{|
((start file:1:2)
(stop file:1:10))
|}]);
Expand Down
54 changes: 36 additions & 18 deletions test/test__txt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -72,92 +72,110 @@ let%expect_test "equal" =
print_s [%sexp { equal : bool; equal_ignores_locs : bool }]
in
test a1 a1;
[%expect {|
[%expect
{|
((equal true)
(equal_ignores_locs true))
|}];
test a1 a2;
[%expect {|
[%expect
{|
((equal true)
(equal_ignores_locs true))
|}];
test a1 a3;
[%expect {|
[%expect
{|
((equal false)
(equal_ignores_locs false))
|}];
test b1 b1;
[%expect {|
[%expect
{|
((equal true)
(equal_ignores_locs true))
|}];
test b1 b2;
[%expect {|
[%expect
{|
((equal true)
(equal_ignores_locs true))
|}];
test b1 b3;
[%expect {|
[%expect
{|
((equal false)
(equal_ignores_locs false))
|}];
test c1 c1;
[%expect {|
[%expect
{|
((equal true)
(equal_ignores_locs true))
|}];
test c1 c2;
[%expect {|
[%expect
{|
((equal true)
(equal_ignores_locs true))
|}];
test c1 c3;
[%expect {|
[%expect
{|
((equal false)
(equal_ignores_locs false))
|}];
test a1 b1;
[%expect {|
[%expect
{|
((equal false)
(equal_ignores_locs true))
|}];
test a2 b2;
[%expect {|
[%expect
{|
((equal false)
(equal_ignores_locs true))
|}];
test a3 b3;
[%expect {|
[%expect
{|
((equal false)
(equal_ignores_locs true))
|}];
test a1 c1;
[%expect {|
[%expect
{|
((equal false)
(equal_ignores_locs true))
|}];
test a2 c2;
[%expect {|
[%expect
{|
((equal false)
(equal_ignores_locs true))
|}];
test a3 c3;
[%expect {|
[%expect
{|
((equal false)
(equal_ignores_locs true))
|}];
test b1 c1;
[%expect {|
[%expect
{|
((equal false)
(equal_ignores_locs true))
|}];
test b2 c2;
[%expect {|
[%expect
{|
((equal false)
(equal_ignores_locs true))
|}];
test b3 c3;
[%expect {|
[%expect
{|
((equal false)
(equal_ignores_locs true))
|}];
Expand Down

0 comments on commit e855f49

Please sign in to comment.