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 80a787a commit 7d5414b
Show file tree
Hide file tree
Showing 45 changed files with 326 additions and 273 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 bopkit-tests.opam
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ bug-reports: "https://github.com/mbarbin/bopkit/issues"
depends: [
"dune" {>= "3.16"}
"ocaml" {>= "5.2"}
"ocamlformat" {with-dev-setup & = "0.26.2"}
"ocamlformat" {with-dev-setup & = "0.27.0"}
"ANSITerminal" {>= "0.8.3"}
"appendable-list" {>= "v0.17" & < "v0.18"}
"auto-format" {>= "0.0.14"}
Expand Down
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@
(ocamlformat
(and
:with-dev-setup
(= 0.26.2)))
(= 0.27.0)))
(ANSITerminal
(>= 0.8.3))
(appendable-list
Expand Down
12 changes: 6 additions & 6 deletions lib/bit_utils/src/bit_counter.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ let blit_next_value t ~dst ~dst_pos =
raise_s
[%sexp
"Bit_counter.blit_next_value"
, "dst length is too short"
, { bit_counter_length = (t.length : int)
; dst_pos : int
; dst_length = (len : int)
; required_length = (dst_pos + t.length : int)
}];
, "dst length is too short"
, { bit_counter_length = (t.length : int)
; dst_pos : int
; dst_length = (len : int)
; required_length = (dst_pos + t.length : int)
}];
let next_value = t.next_value in
let tmp = Array.create ~len:t.length false in
Bit_array.blit_int ~dst:tmp ~src:next_value;
Expand Down
2 changes: 1 addition & 1 deletion lib/bit_utils/test/test__bit_array.ml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ let%expect_test "to_signed_int / to_int" =
raise_s
[%sexp
"Unexpected signed int"
, { t : Bit_array.t; int : int; expected_signed_int : int; signed_int : int }])
, { t : Bit_array.t; int : int; expected_signed_int : int; signed_int : int }])
;;

let%expect_test "sequence" =
Expand Down
18 changes: 12 additions & 6 deletions lib/bit_utils/test/test__bit_matrix.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ let%expect_test "init" =
[%expect {| (() () ()) |}];
let t = Bit_matrix.init_matrix_linear ~dimx:3 ~dimy:5 ~f:(fun i -> i mod 2 = 1) in
Bit_matrix.to_text_channel t stdout;
[%expect {|
[%expect
{|
01010
10101
01010 |}]
Expand All @@ -19,18 +20,21 @@ let%expect_test "of_bit_array" =
let test t = Bit_matrix.to_text_channel t stdout in
(* Shorter than input *)
test (Bit_matrix.of_bit_array ~dimx:2 ~dimy:6 bit_array);
[%expect {|
[%expect
{|
010101
010101 |}];
(* Equal size of input *)
test (Bit_matrix.of_bit_array ~dimx:3 ~dimy:8 bit_array);
[%expect {|
[%expect
{|
01010101
01010101
01010101 |}];
(* Longer than input *)
test (Bit_matrix.of_bit_array ~dimx:4 ~dimy:9 bit_array);
[%expect {|
[%expect
{|
010101010
101010101
010101000
Expand All @@ -48,7 +52,8 @@ let%expect_test "of_text_file" =
Bit_matrix.to_text_channel t stdout
in
test ~dimx:2 ~dimy:12;
[%expect {|
[%expect
{|
010101010101
011111111110 |}];
test ~dimx:3 ~dimy:24;
Expand All @@ -58,7 +63,8 @@ let%expect_test "of_text_file" =
000000000000000000000000
000000000000000000000000 |}];
test ~dimx:4 ~dimy:4;
[%expect {|
[%expect
{|
0101
0101
0101
Expand Down
3 changes: 2 additions & 1 deletion lib/bit_utils/test/test__bit_string_encoding.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ let%expect_test "T encoding" =
let t2 = Bit_string_encoding.Bit.of_char char in
assert (T.equal t t2);
print_s [%sexp { t : T.t; char : Char.t }]);
[%expect {|
[%expect
{|
((t false) (char 0))
((t true) (char 1)) |}]
;;
Expand Down
4 changes: 2 additions & 2 deletions lib/bit_utils/test/test__partial_bit_array.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ let%expect_test "to_string roundtrip" =
raise_s
[%sexp
"Value does not roundtrip"
, { t1 : Partial_bit_array.t; t2 : Partial_bit_array.t }])
, { t1 : Partial_bit_array.t; t2 : Partial_bit_array.t }])
;;

let%expect_test "text files" =
Expand All @@ -53,7 +53,7 @@ let%expect_test "text files" =
raise_s
[%sexp
"Value does not roundtrip"
, { t : Partial_bit_array.t; t2 : Partial_bit_array.t }];
, { t : Partial_bit_array.t; t2 : Partial_bit_array.t }];
let contents2 = Partial_bit_array.to_string t ^ "\n" in
if not (String.equal contents contents2)
then
Expand Down
15 changes: 10 additions & 5 deletions lib/bit_utils/test/test__partial_bit_matrix.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@ let%expect_test "of_partial_bit_array" =
let test t = Partial_bit_matrix.to_text_channel t stdout in
(* Shorter than input *)
test (Partial_bit_matrix.of_partial_bit_array ~dimx:2 ~dimy:6 partial_bit_array);
[%expect {|
[%expect
{|
0*0101
*1010* |}];
(* Equal size of input *)
test (Partial_bit_matrix.of_partial_bit_array ~dimx:3 ~dimy:8 partial_bit_array);
[%expect {|
[%expect
{|
0*0101*1
010*0101
*1010*01 |}];
(* Longer than input *)
test (Partial_bit_matrix.of_partial_bit_array ~dimx:4 ~dimy:9 partial_bit_array);
[%expect {|
[%expect
{|
0*0101*10
10*0101*1
010*01***
Expand All @@ -34,7 +37,8 @@ let%expect_test "of_text_file" =
Partial_bit_matrix.to_text_channel t stdout
in
test ~dimx:2 ~dimy:12;
[%expect {|
[%expect
{|
010*010*01*1
0**111*11110 |}];
test ~dimx:3 ~dimy:24;
Expand All @@ -44,7 +48,8 @@ let%expect_test "of_text_file" =
************************
************************ |}];
test ~dimx:4 ~dimy:4;
[%expect {|
[%expect
{|
010*
010*
01*1
Expand Down
4 changes: 2 additions & 2 deletions lib/bopkit/src/comment.ml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ let parse_exn comment =
[%sexp
"Internal error. A program fragment was parsed as a comment by the parser, but \
later not recognized as such. Please report upstream."
, [%here]
, { comment : string }]
, [%here]
, { comment : string }]
;;

let render = function
Expand Down
14 changes: 8 additions & 6 deletions lib/bopkit/src/string_with_vars.ml
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ let parse t =
then ()
else (
match
if Char.equal t.[i] '$'
&& i <= len_t - 2
&& Char.( = ) t.[Int.succ i] (Syntax.open_char Dollar)
if
Char.equal t.[i] '$'
&& i <= len_t - 2
&& Char.( = ) t.[Int.succ i] (Syntax.open_char Dollar)
then Some Syntax.Dollar
else if Char.equal t.[i] '%'
&& i <= len_t - 2
&& Char.( = ) t.[Int.succ i] (Syntax.open_char Percent)
else if
Char.equal t.[i] '%'
&& i <= len_t - 2
&& Char.( = ) t.[Int.succ i] (Syntax.open_char Percent)
then Some Syntax.Percent
else None
with
Expand Down
27 changes: 18 additions & 9 deletions lib/bopkit/test/test__comment.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ let%expect_test "categorise" =
test "//Hey*/";
[%expect {| // Hey*/ |}];
test "/*/Hey*/";
[%expect {|
[%expect
{|
/* /Hey
*/ |}];
test
Expand All @@ -37,14 +38,17 @@ But then it has another line which is not part of a comment
test "/**/";
[%expect {| /* */ |}];
test "/***/";
[%expect {|
[%expect
{|
/**
*/ |}];
test "/* */";
[%expect {|
[%expect
{|
/* */ |}];
test "/** */";
[%expect {|
[%expect
{|
/**
*/ |}];
test "/* A one line with the enclosing syntax of multiple lines comment */";
Expand All @@ -53,7 +57,8 @@ But then it has another line which is not part of a comment
/* A one line with the enclosing syntax of multiple lines comment
*/ |}];
test "/** A documentation comment that fits on 1 line. */";
[%expect {|
[%expect
{|
/**
* A documentation comment that fits on 1 line.
*/ |}];
Expand All @@ -71,7 +76,8 @@ But then it has another line which is not part of a comment
* with non aligned text
* hello
*/ |}];
test {|
test
{|
/**
* This is some documentation comment
* That is already rendered.
Expand All @@ -96,7 +102,8 @@ But then it has another line which is not part of a comment
* This is some documentation comment
* That is already rendered sligthly differently.
*/ |}];
test {|
test
{|
/* This is some non documentation comment
* That is already rendered.
*/
Expand Down Expand Up @@ -170,7 +177,8 @@ But then it has another line which is not part of a comment
*
*/
|};
[%expect {|
[%expect
{|
/* A multiline comment
* With trailing whitespaces also
*/ |}];
Expand Down Expand Up @@ -214,7 +222,8 @@ But then it has another line which is not part of a comment
* | Check out this
* | for example.
*/ |}];
test {|
test
{|
/// Single line comments can be documentation comments too!
|};
[%expect {| /// Single line comments can be documentation comments too! |}];
Expand Down
9 changes: 6 additions & 3 deletions lib/bopkit/test/test__interval.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,23 @@ let%expect_test "expand_list" =
test [ { from = 0; to_ = 0 } ];
[%expect {| ((0)) |}];
test [ { from = 0; to_ = -4 } ];
[%expect {|
[%expect
{|
((0)
(-1)
(-2)
(-3)
(-4)) |}];
test [ { from = -1; to_ = 2 } ];
[%expect {|
[%expect
{|
((-1)
(0)
(1)
(2)) |}];
test [ { from = 0; to_ = 1 }; { from = 0; to_ = 2 } ];
[%expect {|
[%expect
{|
((0 0)
(0 1)
(0 2)
Expand Down
Loading

0 comments on commit 7d5414b

Please sign in to comment.