summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/error.ml2
-rw-r--r--lib/kDL.ml95
-rw-r--r--lib/kDL_lens_result.ml (renamed from lib/kdl_lens_result.ml)0
-rw-r--r--lib/manifest.ml134
-rw-r--r--lib/nixtamal.ml8
-rw-r--r--lib/util.ml91
-rw-r--r--test/test_input.ml22
7 files changed, 178 insertions, 174 deletions
diff --git a/lib/error.ml b/lib/error.ml
index 4255c79..a658f50 100644
--- a/lib/error.ml
+++ b/lib/error.ml
@@ -5,7 +5,7 @@
open Name
type manifest_error = [
- | `Parsing of Util.KDL.Valid.err list
+ | `Parsing of KDL.Valid.err list
| `Not_set_up
| `File_already_exists
]
diff --git a/lib/kDL.ml b/lib/kDL.ml
new file mode 100644
index 0000000..550c26f
--- /dev/null
+++ b/lib/kDL.ml
@@ -0,0 +1,95 @@
+(*─────────────────────────────────────────────────────────────────────────────┐
+│ SPDX-FileCopyrightText: 2025 toastal <https://toast.al/contact/> │
+│ SPDX-License-Identifier: LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception │
+└─────────────────────────────────────────────────────────────────────────────*)
+(* extend & fix casing for ocaml-kdl *)
+include Kdl
+
+let of_flow flow =
+ try
+ Eio.Buf_read.parse_exn
+ (fun buf -> Eio.Buf_read.take_all buf |> Kdl.of_string)
+ ~max_size: max_int
+ flow
+ with
+ | exn -> failwith (Printexc.to_string exn)
+
+let to_flow flow doc =
+ Eio.Buf_write.with_flow flow @@ fun buf ->
+ let out_string s off len =
+ String.sub s off len |> Eio.Buf_write.string buf
+ in
+ let flush () = () in
+ let ppf = Format.make_formatter out_string flush in
+
+ (* replace spaces with tabs for indentation *)
+ let base_fmt = Format.pp_get_formatter_out_functions ppf () in
+ let tabbed_fmt = {base_fmt with
+ out_indent = (fun n -> base_fmt.out_string (String.make n '\t') 0 n)
+ }
+ in
+ Format.pp_set_formatter_out_functions ppf tabbed_fmt;
+
+ (* enable utf-8 and pretty-print *)
+ Fmt.set_utf_8 ppf true;
+ pp ppf doc;
+ Format.pp_print_flush ppf ()
+
+module L = KDL_lens_result
+
+module Valid = struct
+ type err = [
+ | L.lerr
+ | `ParseError of Kdl.error
+ | `OneRequired of string list
+ | `OnlyOneOf of string list
+ | `InvalidLatestCmd of string
+ | `InvalidHashAlgorithm of string
+ ]
+ [@@deriving show]
+ type 'a t = ('a, err list) result
+ let pp ~(ok : 'a Fmt.t) : 'a t Fmt.t =
+ Fmt.result ~ok ~error: (Fmt.list pp_err)
+ let map = Result.map
+ let map1 (f : 'a -> 'b) (vx : ('a, err) result) : 'b t =
+ match vx with
+ | Ok x -> Ok (f x)
+ | Error e -> Error [e]
+ let map_error = Result.map_error
+ let pure x = Ok x
+ let and_map (vx : 'a t) (vf : ('a -> 'b) t) =
+ match vx, vf with
+ | Ok x, Ok f -> Ok (f x)
+ | Error e, Ok _ -> Error e
+ | Ok _, Error e -> Error e
+ | Error e1, Error e2 -> Error (e2 @ e1)
+ let product (vx : 'a t) (vy : 'b t) =
+ match vx, vy with
+ | Ok x, Ok y -> Ok (x, y)
+ | Error e, Ok _ -> Error e
+ | Ok _, Error e -> Error e
+ | Error e1, Error e2 -> Error (e2 @ e1)
+ let and_map1 (vx : ('a, err) result) (vf : ('a -> 'b) t) =
+ match vx, vf with
+ | Ok x, Ok f -> Ok (f x)
+ | Error e, Ok _ -> Error [e]
+ | Ok _, Error e -> Error e
+ | Error e1, Error e2 -> Error (e2 @ [e1])
+ let bind = Result.bind
+ let lift_lens (r : ('a, L.lerr) result) : ('a, err list) result =
+ Result.map_error (fun e -> ([e] :> err list)) r
+ let ll = lift_lens
+ let (let+) vx f = map f vx
+ let (and+) = product
+ let (let*) = bind
+end
+
+type 'a codec = {
+ to_kdl: 'a -> t;
+ of_kdl: t -> 'a Valid.t
+}
+
+type 'a node_codec = {
+ to_node: 'a -> node;
+ of_node: node -> 'a Valid.t
+}
diff --git a/lib/kdl_lens_result.ml b/lib/kDL_lens_result.ml
index 9ead98e..9ead98e 100644
--- a/lib/kdl_lens_result.ml
+++ b/lib/kDL_lens_result.ml
diff --git a/lib/manifest.ml b/lib/manifest.ml
index 9313dad..a669254 100644
--- a/lib/manifest.ml
+++ b/lib/manifest.ml
@@ -17,16 +17,16 @@ module Template = struct
include Input.Template
let to_arg ?annot tpl =
- Kdl.arg ?annot (`String (take tpl))
+ KDL.arg ?annot (`String (take tpl))
let of_child ~name kdl =
- let open Util.KDL.L in
- let open Util.KDL.Valid in
+ let open KDL.L in
+ let open KDL.Valid in
ll @@ Result.map make (kdl.@(child name // arg 0 // string_value))
let of_mirrors kdl =
- let open Util.KDL.L in
- let open Util.KDL.Valid in
+ let open KDL.L in
+ let open KDL.Valid in
ll @@
match kdl.@(child "mirrors" // args // each string_value) with
| Ok ms -> Ok (List.map make ms)
@@ -47,9 +47,9 @@ module File = struct
let [@inline]of_manifest ({url; mirrors}: t) : Input.File.t =
Input.File.make ~url ~mirrors ()
- let codec : t Util.KDL.codec = {
+ let codec : t KDL.codec = {
to_kdl = (fun file ->
- let open Kdl in
+ let open KDL in
let nodes =
if List.is_empty file.mirrors then
[]
@@ -62,8 +62,8 @@ module File = struct
[node "file" nodes]
);
of_kdl = (fun kdl ->
- let open Util.KDL.L in
- let open Util.KDL.Valid in
+ let open KDL.L in
+ let open KDL.Valid in
let* file = ll @@ kdl.@(node "file") in
let+ url = Template.of_child ~name: "url" file
and+ mirrors = Template.of_mirrors file
@@ -86,9 +86,9 @@ module Archive = struct
let [@inline]of_manifest ({url; mirrors}: t) : Input.Archive.t =
Input.Archive.make ~url ~mirrors ()
- let codec : t Util.KDL.codec = {
+ let codec : t KDL.codec = {
to_kdl = (fun archive ->
- let open Kdl in
+ let open KDL in
let url =
node "url" ~args: [Template.to_arg archive.url] [];
and nodes =
@@ -101,8 +101,8 @@ module Archive = struct
[node "archive" nodes]
);
of_kdl = (fun kdl ->
- let open Util.KDL.L in
- let open Util.KDL.Valid in
+ let open KDL.L in
+ let open KDL.Valid in
let* archive = ll @@ kdl.@(node "archive") in
let+ url = Template.of_child ~name: "url" archive
and+ mirrors = Template.of_mirrors archive
@@ -117,16 +117,16 @@ module Git = struct
type t = Input.Git.Reference.t
[@@deriving show, eq, qcheck]
- let codec : t Util.KDL.codec = {
+ let codec : t KDL.codec = {
to_kdl = (fun ref ->
- let open Kdl in
+ let open KDL in
match ref with
- | `Branch b -> [Kdl.node "branch" ~args: [arg (`String b)] []]
- | `Ref r -> [Kdl.node "ref" ~args: [arg (`String r)] []]
+ | `Branch b -> [KDL.node "branch" ~args: [arg (`String b)] []]
+ | `Ref r -> [KDL.node "ref" ~args: [arg (`String r)] []]
);
of_kdl = (fun kdl ->
- let open Util.KDL.L in
- let open Util.KDL.Valid in
+ let open KDL.L in
+ let open KDL.Valid in
let node_names = ["branch"; "ref"]
and branch = ll @@ kdl.@(node "branch" // arg 0 // string_value)
and ref = ll @@ kdl.@(node "ref" // arg 0 // string_value)
@@ -155,9 +155,9 @@ module Git = struct
let [@inline]of_manifest ({repository; mirrors; reference; submodules; lfs}: t) : Input.Git.t =
Input.Git.make ~repository ~mirrors ~reference ~submodules ~lfs ()
- let codec : t Util.KDL.codec = {
+ let codec : t KDL.codec = {
to_kdl = (fun git ->
- let open Kdl in
+ let open KDL in
let repository =
node "repository" ~args: [Template.to_arg git.repository] []
and nodes =
@@ -181,8 +181,8 @@ module Git = struct
[node "git" nodes]
);
of_kdl = (fun kdl ->
- let open Util.KDL.L in
- let open Util.KDL.Valid in
+ let open KDL.L in
+ let open KDL.Valid in
let* git = ll @@ kdl.@(node "git") in
let+ repository = Template.of_child ~name: "repository" git
and+ mirrors = Template.of_mirrors git
@@ -238,17 +238,17 @@ module Darcs = struct
]
[@@deriving show, eq, qcheck]
- let codec : t Util.KDL.codec = {
+ let codec : t KDL.codec = {
to_kdl = (fun ref ->
- let open Kdl in
+ let open KDL in
match ref with
- | `Context (`Stated sc) -> [Kdl.node "context" ~args: [arg (`String sc)] []]
+ | `Context (`Stated sc) -> [KDL.node "context" ~args: [arg (`String sc)] []]
| `Context (`Assumed _) -> []
- | `Tag t -> [Kdl.node "tag" ~args: [arg (`String t)] []]
+ | `Tag t -> [KDL.node "tag" ~args: [arg (`String t)] []]
);
of_kdl = (fun kdl ->
- let open Util.KDL.L in
- let open Util.KDL.Valid in
+ let open KDL.L in
+ let open KDL.Valid in
let node_names = ["tag"; "context"]
and context = ll @@ kdl.@(node "context" // arg 0 // string_value)
and tag = ll @@ kdl.@(node "tag" // arg 0 // string_value)
@@ -275,9 +275,9 @@ module Darcs = struct
let [@inline]of_manifest ({repository; mirrors; reference}: t) : Input.Darcs.t =
Input.Darcs.make ~repository ~mirrors ~reference ()
- let codec : t Util.KDL.codec = {
+ let codec : t KDL.codec = {
to_kdl = (fun darcs ->
- let open Kdl in
+ let open KDL in
let repository =
node "repository" ~args: [Template.to_arg darcs.repository] []
and nodes =
@@ -293,8 +293,8 @@ module Darcs = struct
[node "darcs" nodes]
);
of_kdl = (fun kdl ->
- let open Util.KDL.L in
- let open Util.KDL.Valid in
+ let open KDL.L in
+ let open KDL.Valid in
let* darcs = ll @@ kdl.@(node "darcs") in
let+ repository = Template.of_child ~name: "repository" darcs
and+ mirrors = Template.of_mirrors darcs
@@ -310,17 +310,17 @@ module Pijul = struct
type t = Input.Pijul.Reference.t
[@@deriving show, eq, qcheck]
- let codec : t Util.KDL.codec = {
+ let codec : t KDL.codec = {
to_kdl = (fun ref ->
- let open Kdl in
+ let open KDL in
match ref with
- | `Channel c -> [Kdl.node "channel" ~args: [arg (`String c)] []]
- | `State s -> [Kdl.node "state" ~args: [arg (`String s)] []]
- | `Change c -> [Kdl.node "change" ~args: [arg (`String c)] []]
+ | `Channel c -> [KDL.node "channel" ~args: [arg (`String c)] []]
+ | `State s -> [KDL.node "state" ~args: [arg (`String s)] []]
+ | `Change c -> [KDL.node "change" ~args: [arg (`String c)] []]
);
of_kdl = (fun kdl ->
- let open Util.KDL.L in
- let open Util.KDL.Valid in
+ let open KDL.L in
+ let open KDL.Valid in
let node_names = ["channel"; "state"; "change"]
and channel = ll @@ kdl.@(node "channel" // arg 0 // string_value)
and state = ll @@ kdl.@(node "state" // arg 0 // string_value)
@@ -349,9 +349,9 @@ module Pijul = struct
let [@inline]of_manifest ({remote; mirrors; reference}: t) : Input.Pijul.t =
Input.Pijul.make ~remote ~mirrors ~reference ()
- let codec : t Util.KDL.codec = {
+ let codec : t KDL.codec = {
to_kdl = (fun pijul ->
- let open Kdl in
+ let open KDL in
let remote =
node "remote" ~args: [Template.to_arg pijul.remote] []
and nodes =
@@ -367,8 +367,8 @@ module Pijul = struct
[node "pijul" nodes]
);
of_kdl = (fun kdl ->
- let open Util.KDL.L in
- let open Util.KDL.Valid in
+ let open KDL.L in
+ let open KDL.Valid in
let* pijul = ll @@ kdl.@(node "pijul") in
let+ remote = Template.of_child ~name: "remote" pijul
and+ mirrors = Template.of_mirrors pijul
@@ -403,7 +403,7 @@ module Kind = struct
| `Darcs d -> `Darcs (Darcs.of_manifest d)
| `Pijul p -> `Pijul (Pijul.of_manifest p)
- let codec : t Util.KDL.codec = {
+ let codec : t KDL.codec = {
to_kdl = (function
| `File f -> File.codec.to_kdl f
| `Archive a -> Archive.codec.to_kdl a
@@ -449,9 +449,9 @@ module Hash = struct
let [@inline]of_manifest ({algorithm; expected}: t) : Input.Hash.t =
Input.Hash.make ~algorithm ?expected ()
- let codec : t Util.KDL.codec = {
+ let codec : t KDL.codec = {
to_kdl = (fun hash ->
- let open Kdl in
+ let open KDL in
let props =
match hash.expected with
| None -> []
@@ -465,8 +465,8 @@ module Hash = struct
[node "hash" ~props []]
);
of_kdl = (fun kdl ->
- let open Util.KDL.L in
- let open Util.KDL.Valid in
+ let open KDL.L in
+ let open KDL.Valid in
let* hash = ll @@ kdl.@(node "hash") in
let+ algorithm : Input.Hash.algorithm option =
match hash.@(prop "algorithm") with
@@ -518,11 +518,11 @@ module Latest_cmd = struct
let [@inline]of_manifest (cmd : t) : Input.Latest.t =
Input.Latest.make ?cmd ()
- let codec : t Util.KDL.codec = {
+ let codec : t KDL.codec = {
to_kdl = (function
| None -> []
| Some (exec, pipes) ->
- let open Kdl in
+ let open KDL in
let cmd_args ({prog; args}: Input.Latest.Cmd.cmd) =
List.map (Template.to_arg) (prog :: args)
in
@@ -535,9 +535,9 @@ module Latest_cmd = struct
[node "latest-cmd" nodes]
);
of_kdl = (fun kdl ->
- let open Util.KDL.L in
- let open Util.KDL.Valid in
- let extract_cmd (node : Kdl.node) : Input.Latest.Cmd.cmd Util.KDL.Valid.t =
+ let open KDL.L in
+ let open KDL.Valid in
+ let extract_cmd (node : KDL.node) : Input.Latest.Cmd.cmd KDL.Valid.t =
if List.is_empty node.props then
match Util.Non_empty_list.of_list node.args with
| Some (arg_prog, arg_args) ->
@@ -612,9 +612,9 @@ module Input' = struct
frozen = mnfst.frozen;
}
- let codec : t Util.KDL.node_codec = {
+ let codec : t KDL.node_codec = {
to_node = (fun input ->
- let open Kdl in
+ let open KDL in
let props =
if input.frozen then
[("frozen", arg (`Bool true))]
@@ -628,8 +628,8 @@ module Input' = struct
node (Name.take input.name) ~props nodes
);
of_node = (fun input ->
- let open Util.KDL.L in
- let open Util.KDL.Valid in
+ let open KDL.L in
+ let open KDL.Valid in
let+ name =
ll @@ input.@(node_name)
|> Result.map Name.make
@@ -663,9 +663,9 @@ type t = {
}
[@@deriving show, eq, make, qcheck]
-let document_to_t (doc : Kdl.t) : t Util.KDL.Valid.t =
- let open Util.KDL.L in
- let open Util.KDL.Valid in
+let document_to_t (doc : KDL.t) : t KDL.Valid.t =
+ let open KDL.L in
+ let open KDL.Valid in
let* manifest_default_hash_algorithm : Input.Hash.algorithm option =
match ll @@ doc.@(node "default_hash_algorithm" // arg 0 // string_value) with
| Ok dha ->
@@ -686,7 +686,7 @@ let document_to_t (doc : Kdl.t) : t Util.KDL.Valid.t =
(* TODO: a lens would mean this could use `each` *)
let rec get_inputs acc = function
| [] -> acc
- | (input : Kdl.node) :: inputs_tail ->
+ | (input : KDL.node) :: inputs_tail ->
let acc' =
match acc, Input'.codec.of_node input with
| Error errs, Ok _ -> Error errs
@@ -702,7 +702,7 @@ let document_to_t (doc : Kdl.t) : t Util.KDL.Valid.t =
in
make ~version ~inputs ()
-let manifest : Kdl.t option ref = ref None
+let manifest : KDL.t option ref = ref None
let exists () : bool =
let working_dir = Working_directory.get () in
@@ -716,14 +716,14 @@ let read () =
Logs.info (fun m -> m "Reading manifest @@ %a …" Eio.Path.pp filepath);
let* kdl =
Eio.Path.with_open_in filepath @@ fun flow ->
- Util.KDL.of_flow flow
+ KDL.of_flow flow
in
let () = manifest := Some kdl in
Ok kdl
let make ?(version = "0.1.0") () =
Logs.app (fun m -> m "Making manifest file @@ version:%s" version);
- let open Kdl in
+ let open KDL in
let doc = [
node "version" ~args: [arg (`String version)] [];
node "inputs" (
@@ -734,7 +734,7 @@ let make ?(version = "0.1.0") () =
);
]
in
- Logs.debug (fun m -> m "New KDL doc:@;%a@." Kdl.pp doc);
+ Logs.debug (fun m -> m "New KDL doc:@;%a@." KDL.pp doc);
manifest := Some doc
let write () : (unit, error) result =
@@ -756,7 +756,7 @@ let write () : (unit, error) result =
]
in
Eio.Flow.write flow banner;
- Util.KDL.to_flow flow mnfst;
+ KDL.to_flow flow mnfst;
Eio.Flow.write flow ([Cstruct.of_string "\n"])
in
Logs.app (fun m -> m "Manifest written.");
diff --git a/lib/nixtamal.ml b/lib/nixtamal.ml
index 5a27232..f8b9203 100644
--- a/lib/nixtamal.ml
+++ b/lib/nixtamal.ml
@@ -9,7 +9,7 @@ module Lockfile = Lockfile
module Input = Input
module Input_foreman = Input_foreman
module Working_directory = Working_directory
-module Util = Util
+module KDL = KDL
type error = Error.error
@@ -45,11 +45,11 @@ let read_manifest_and_lockfile () : (Name.Name.t list, error) result =
let* manifest =
Error.tag_manifest @@ begin
match Manifest.read () with
- | Ok(kdl : Kdl.t) ->
+ | Ok(kdl : KDL.t) ->
Manifest.document_to_t kdl
|> Result.map_error (fun err -> `Parsing err)
- | Error(e : Kdl.error) ->
- let v_errs : Util.KDL.Valid.err list = [`ParseError e] in
+ | Error(e : KDL.error) ->
+ let v_errs : KDL.Valid.err list = [`ParseError e] in
Error (`Parsing v_errs)
end
in
diff --git a/lib/util.ml b/lib/util.ml
index 02b2ea2..b76a789 100644
--- a/lib/util.ml
+++ b/lib/util.ml
@@ -68,97 +68,6 @@ module Jsont = struct
| Error err -> Error err
end
-module KDL = struct
- let of_flow flow =
- try
- Eio.Buf_read.parse_exn
- (fun buf -> Eio.Buf_read.take_all buf |> Kdl.of_string)
- ~max_size: max_int
- flow
- with
- | exn -> failwith (Printexc.to_string exn)
-
- let to_flow flow doc =
- Eio.Buf_write.with_flow flow @@ fun buf ->
- let out_string s off len =
- String.sub s off len |> Eio.Buf_write.string buf
- in
- let flush () = () in
- let ppf = Format.make_formatter out_string flush in
-
- (* replace spaces with tabs for indentation *)
- let base_fmt = Format.pp_get_formatter_out_functions ppf () in
- let tabbed_fmt = {base_fmt with
- out_indent = (fun n -> base_fmt.out_string (String.make n '\t') 0 n)
- }
- in
- Format.pp_set_formatter_out_functions ppf tabbed_fmt;
-
- (* enable utf-8 and pretty-print *)
- Fmt.set_utf_8 ppf true;
- Kdl.pp ppf doc;
- Format.pp_print_flush ppf ()
-
- module L = Kdl_lens_result
-
- module Valid = struct
- type err = [
- | L.lerr
- | `ParseError of Kdl.error
- | `OneRequired of string list
- | `OnlyOneOf of string list
- | `InvalidLatestCmd of string
- | `InvalidHashAlgorithm of string
- ]
- [@@deriving show]
- type 'a t = ('a, err list) result
- let pp ~(ok : 'a Fmt.t) : 'a t Fmt.t =
- Fmt.result ~ok ~error: (Fmt.list pp_err)
- let map = Result.map
- let map1 (f : 'a -> 'b) (vx : ('a, err) result) : 'b t =
- match vx with
- | Ok x -> Ok (f x)
- | Error e -> Error [e]
- let map_error = Result.map_error
- let pure x = Ok x
- let and_map (vx : 'a t) (vf : ('a -> 'b) t) =
- match vx, vf with
- | Ok x, Ok f -> Ok (f x)
- | Error e, Ok _ -> Error e
- | Ok _, Error e -> Error e
- | Error e1, Error e2 -> Error (e2 @ e1)
- let product (vx : 'a t) (vy : 'b t) =
- match vx, vy with
- | Ok x, Ok y -> Ok (x, y)
- | Error e, Ok _ -> Error e
- | Ok _, Error e -> Error e
- | Error e1, Error e2 -> Error (e2 @ e1)
- let and_map1 (vx : ('a, err) result) (vf : ('a -> 'b) t) =
- match vx, vf with
- | Ok x, Ok f -> Ok (f x)
- | Error e, Ok _ -> Error [e]
- | Ok _, Error e -> Error e
- | Error e1, Error e2 -> Error (e2 @ [e1])
- let bind = Result.bind
- let lift_lens (r : ('a, L.lerr) result) : ('a, err list) result =
- Result.map_error (fun e -> ([e] :> err list)) r
- let ll = lift_lens
- let (let+) vx f = map f vx
- let (and+) = product
- let (let*) = bind
- end
-
- type 'a codec = {
- to_kdl: 'a -> Kdl.t;
- of_kdl: Kdl.t -> 'a Valid.t
- }
-
- type 'a node_codec = {
- to_node: 'a -> Kdl.node;
- of_node: Kdl.node -> 'a Valid.t
- }
-end
-
module These = struct
type ('a, 'b) t =
| This of 'a
diff --git a/test/test_input.ml b/test/test_input.ml
index 92eb308..ccfd595 100644
--- a/test/test_input.ml
+++ b/test/test_input.ml
@@ -7,7 +7,7 @@ open Nixtamal
let suite =
[test_case "Manifest latest-cmd to KDL" `Quick (fun () ->
- let kdl = testable Kdl.pp Kdl.equal in
+ let kdl = testable KDL.pp KDL.equal in
let open Nixtamal.Input.Latest.Cmd in
let t = Input.Template.make in
let in_kdl =
@@ -23,7 +23,7 @@ let suite =
| head -n1
}
|}
- |> Kdl.of_string
+ |> KDL.of_string
|> Result.get_ok
in
check kdl "KDL latest-cmd with pipe" out_kdl in_kdl
@@ -40,12 +40,12 @@ let suite =
| head -n1
}
|}
- |> Kdl.of_string
+ |> KDL.of_string
|> Result.get_ok
in
match Manifest.Latest_cmd.codec.of_kdl kdl with
| Ok lc -> lc
- | Error err -> failwith Fmt.(str "%a from %a" (list ~sep: semi Util.KDL.Valid.pp_err) err Kdl.pp kdl)
+ | Error err -> failwith Fmt.(str "%a from %a" (list ~sep: semi KDL.Valid.pp_err) err KDL.pp kdl)
in
let out_latest_cmd =
~${prog = t "curl"; args = [t "https://toast.al"]}
@@ -55,7 +55,7 @@ let suite =
check latest_cmd "latest-cmd with pipe from KDL" out_latest_cmd in_latest_cmd
);
test_case "Manifest frozen Pijul to KDL" `Quick (fun () ->
- let kdl = testable Kdl.pp Kdl.equal in
+ let kdl = testable KDL.pp KDL.equal in
let t = Input.Template.make in
let in_kdl =
let name = Name.Name.make "pijul"
@@ -74,15 +74,15 @@ let suite =
}
}
|}
- |> Kdl.of_string
+ |> KDL.of_string
|> Result.get_ok
in
check kdl "KDL frozen Pijul" out_kdl [in_kdl]
);
test_case "Manifest frozen Pijul of KDL" `Quick (fun () ->
let input = testable Manifest.Input'.pp Manifest.Input'.equal in
- let open Util.KDL.L in
- let open Util.KDL.Valid in
+ let open KDL.L in
+ let open KDL.Valid in
let t = Input.Template.make in
let in_input =
let kdl =
@@ -94,13 +94,13 @@ let suite =
}
}
|}
- |> Kdl.of_string
+ |> KDL.of_string
|> Result.get_ok
in
let node = ll @@ kdl.@(node "pijul" ~nth: 0) in
match Result.bind node Manifest.Input'.codec.of_node with
| Ok lc -> lc
- | Error err -> failwith Fmt.(str "%a from %a" (list ~sep: semi Util.KDL.Valid.pp_err) err Kdl.pp kdl)
+ | Error err -> failwith Fmt.(str "%a from %a" (list ~sep: semi KDL.Valid.pp_err) err KDL.pp kdl)
in
let out_input =
let name = Name.Name.make "pijul"
@@ -151,7 +151,7 @@ let suite =
Manifest.Input'.pp
input'
| Error err ->
- QCheck.Test.fail_reportf "%a" Fmt.(list ~sep: semi Util.KDL.Valid.pp_err) err;
+ QCheck.Test.fail_reportf "%a" Fmt.(list ~sep: semi KDL.Valid.pp_err) err;
);
QCheck.Test.make
~name: "Input sameshape"