From a24d45875046f1ba40bded7ac5f79db3c51e6a58 Mon Sep 17 00:00:00 2001 From: Mathieu Barbin Date: Fri, 23 Aug 2024 21:42:45 +0200 Subject: [PATCH] Upgrade deps, split tests and use Expect_test_helpers_base --- CHANGES.md | 8 +++++ auto-format-tests.opam | 52 +++++++++++++++++++++++++++ auto-format.opam | 8 ++--- dune-project | 80 ++++++++++++++++++++++++++++++++++++++---- src/auto_format.ml | 4 +-- src/dune | 3 ++ test/dune | 8 +++-- 7 files changed, 147 insertions(+), 16 deletions(-) create mode 100644 auto-format-tests.opam diff --git a/CHANGES.md b/CHANGES.md index f94d2c1..6440354 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,11 @@ +## 0.0.11 (2024-08-23) + +### Changed + +- Split test package and use `Expect_test_helpers_base`. +- Upgrade to `parsing-utils.0.0.8`. +- Upgrade to `err0.0.0.2` & `loc0.0.1.0`. + ## 0.0.10 (2024-08-22) ### Changed diff --git a/auto-format-tests.opam b/auto-format-tests.opam new file mode 100644 index 0000000..30af36a --- /dev/null +++ b/auto-format-tests.opam @@ -0,0 +1,52 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +synopsis: "Tests for [Auto-format]" +maintainer: ["Mathieu Barbin"] +authors: ["Mathieu Barbin"] +license: "MIT" +homepage: "https://github.com/mbarbin/auto-format" +doc: "https://mbarbin.github.io/auto-format/" +bug-reports: "https://github.com/mbarbin/auto-format/issues" +depends: [ + "dune" {>= "3.16"} + "ocaml" {>= "5.2"} + "auto-format" {= version} + "base" {>= "v0.17" & < "v0.18"} + "commandlang" {>= "0.0.2"} + "eio" {>= "1.0"} + "eio-writer" {>= "0.0.3"} + "eio_main" {>= "1.0"} + "expect_test_helpers_core" {>= "v0.17" & < "v0.18"} + "fpath" {>= "0.7.3"} + "fpath-base" {>= "0.0.9"} + "loc0" {>= "0.1.0"} + "parsing-utils" {>= "0.0.8"} + "pp" {>= "1.2.0"} + "pp-extended" {>= "0.0.2"} + "ppx_compare" {>= "v0.17" & < "v0.18"} + "ppx_enumerate" {>= "v0.17" & < "v0.18"} + "ppx_expect" {>= "v0.17" & < "v0.18"} + "ppx_hash" {>= "v0.17" & < "v0.18"} + "ppx_here" {>= "v0.17" & < "v0.18"} + "ppx_js_style" {dev & >= "v0.17" & < "v0.18"} + "ppx_let" {>= "v0.17" & < "v0.18"} + "ppx_sexp_conv" {>= "v0.17" & < "v0.18"} + "ppx_sexp_value" {>= "v0.17" & < "v0.18"} + "ppxlib" {>= "0.33"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] +] +dev-repo: "git+https://github.com/mbarbin/auto-format.git" diff --git a/auto-format.opam b/auto-format.opam index 7bdcb88..9798e20 100644 --- a/auto-format.opam +++ b/auto-format.opam @@ -11,20 +11,18 @@ depends: [ "dune" {>= "3.16"} "ocaml" {>= "5.2"} "base" {>= "v0.17" & < "v0.18"} - "commandlang" {>= "0.0.1"} + "commandlang" {>= "0.0.2"} "eio" {>= "1.0"} "eio-writer" {>= "0.0.3"} "eio_main" {>= "1.0"} - "expect-test-helpers" {with-test & >= "v0.17" & < "v0.18"} "fpath" {>= "0.7.3"} "fpath-base" {>= "0.0.9"} - "loc" {>= "0.0.2"} - "parsing-utils" {>= "0.0.7"} + "loc0" {>= "0.1.0"} + "parsing-utils" {>= "0.0.8"} "pp" {>= "1.2.0"} "pp-extended" {>= "0.0.2"} "ppx_compare" {>= "v0.17" & < "v0.18"} "ppx_enumerate" {>= "v0.17" & < "v0.18"} - "ppx_expect" {with-test & >= "v0.17" & < "v0.18"} "ppx_hash" {>= "v0.17" & < "v0.18"} "ppx_here" {>= "v0.17" & < "v0.18"} "ppx_js_style" {dev & >= "v0.17" & < "v0.18"} diff --git a/dune-project b/dune-project index 904ae93..6ac001d 100644 --- a/dune-project +++ b/dune-project @@ -26,26 +26,93 @@ (>= v0.17) (< v0.18))) (commandlang - (>= 0.0.1)) + (>= 0.0.2)) (eio (>= 1.0)) (eio-writer (>= 0.0.3)) (eio_main (>= 1.0)) - (expect-test-helpers + (fpath + (>= 0.7.3)) + (fpath-base + (>= 0.0.9)) + (loc0 + (>= 0.1.0)) + (parsing-utils + (>= 0.0.8)) + (pp + (>= 1.2.0)) + (pp-extended + (>= 0.0.2)) + (ppx_compare + (and + (>= v0.17) + (< v0.18))) + (ppx_enumerate + (and + (>= v0.17) + (< v0.18))) + (ppx_hash + (and + (>= v0.17) + (< v0.18))) + (ppx_here + (and + (>= v0.17) + (< v0.18))) + (ppx_js_style + (and + :dev + (>= v0.17) + (< v0.18))) + (ppx_let + (and + (>= v0.17) + (< v0.18))) + (ppx_sexp_conv + (and + (>= v0.17) + (< v0.18))) + (ppx_sexp_value + (and + (>= v0.17) + (< v0.18))) + (ppxlib + (>= 0.33)))) + +(package + (name auto-format-tests) + (synopsis "Tests for [Auto-format]") + (depends + (ocaml + (>= 5.2)) + (auto-format + (= :version)) + (base + (and + (>= v0.17) + (< v0.18))) + (commandlang + (>= 0.0.2)) + (eio + (>= 1.0)) + (eio-writer + (>= 0.0.3)) + (eio_main + (>= 1.0)) + (expect_test_helpers_core (and - :with-test (>= v0.17) (< v0.18))) (fpath (>= 0.7.3)) (fpath-base (>= 0.0.9)) - (loc - (>= 0.0.2)) + (loc0 + (>= 0.1.0)) (parsing-utils - (>= 0.0.7)) + (>= 0.0.8)) (pp (>= 1.2.0)) (pp-extended @@ -60,7 +127,6 @@ (< v0.18))) (ppx_expect (and - :with-test (>= v0.17) (< v0.18))) (ppx_hash diff --git a/src/auto_format.ml b/src/auto_format.ml index 89da7a7..b75fafe 100644 --- a/src/auto_format.ml +++ b/src/auto_format.ml @@ -86,7 +86,7 @@ struct ~lexbuf:(Lexing.from_string pretty_printed_contents) |> Parsing_result.or_error in - Ref.set_temporarily Loc.equal_ignores_positions true ~f:(fun () -> + Ref.set_temporarily Loc.equal_ignores_locs true ~f:(fun () -> T.equal program program_2) in let ts_are_equal = @@ -302,7 +302,7 @@ into this issue. debug_comments ~f:(fun () -> Parsing_utils.parse_exn (module T_syntax) ~path) in - Ref.set_temporarily Loc.include_sexp_of_positions with_positions ~f:(fun () -> + Ref.set_temporarily Loc.include_sexp_of_locs with_positions ~f:(fun () -> Eio_writer.with_flow (Eio.Stdenv.stdout env) (fun stdout -> Eio_writer.write_sexp stdout [%sexp (program : T.t)]))) ;; diff --git a/src/dune b/src/dune index 2b6924e..ca1ca14 100644 --- a/src/dune +++ b/src/dune @@ -10,6 +10,8 @@ -open Base -open + Loc0 + -open Fpath_base -open Commandlang) @@ -21,6 +23,7 @@ eio_main fpath fpath-base + loc0 parsing-utils pp pp-extended) diff --git a/test/dune b/test/dune index 08e30c0..925b291 100644 --- a/test/dune +++ b/test/dune @@ -1,5 +1,6 @@ (library (name auto_format_test) + (public_name auto-format-tests.auto_format_test) (inline_tests) (flags :standard @@ -10,8 +11,11 @@ -open Base -open - Expect_test_helpers) - (libraries auto_format base expect-test-helpers) + Expect_test_helpers_base) + (libraries + auto_format + base + expect_test_helpers_core.expect_test_helpers_base) (lint (pps ppx_js_style -check-doc-comments)) (preprocess