Micheline: fix dependencies in opam/dune
This commit is contained in:
parent
e4e30bb3d8
commit
f6f047ea15
@ -23,6 +23,32 @@
|
||||
(* *)
|
||||
(*****************************************************************************)
|
||||
|
||||
(* Mini compatibility layer to avoid circular dependency *)
|
||||
module Compat = struct
|
||||
let failwith fmt = Format.kasprintf (fun s -> Lwt.return (Error s)) fmt
|
||||
let return_unit = Lwt.return (Ok ())
|
||||
let (>>=) = Lwt.bind
|
||||
let (>>=?) v f =
|
||||
v >>= function
|
||||
| Error _ as err -> Lwt.return err
|
||||
| Ok v -> f v
|
||||
let rec iter2_p f l1 l2 =
|
||||
match l1, l2 with
|
||||
| [], [] -> return_unit
|
||||
| [], _ | _, [] -> invalid_arg "Error_monad.iter2_p"
|
||||
| x1 :: l1 , x2 :: l2 ->
|
||||
let tx = f x1 x2 and tl = iter2_p f l1 l2 in
|
||||
tx >>= fun tx_res ->
|
||||
tl >>= fun tl_res ->
|
||||
match tx_res, tl_res with
|
||||
| Ok (), Ok () -> Lwt.return (Ok ())
|
||||
| Error exn1, Error exn2 -> failwith "%s -- %s" exn1 exn2
|
||||
| Ok (), Error exn
|
||||
| Error exn, Ok () -> Lwt.return (Error exn)
|
||||
end
|
||||
|
||||
open Compat
|
||||
|
||||
let fail loc printer given expected msg =
|
||||
failwith
|
||||
"@[<v 2> On %s : %s@ @[Given:\t%a@]@ @[Expected:\t%a@]@]"
|
||||
|
@ -1,12 +1,9 @@
|
||||
(executables
|
||||
(names test_parser)
|
||||
(libraries tezos-stdlib-unix
|
||||
tezos-micheline
|
||||
(libraries tezos-micheline
|
||||
alcotest-lwt)
|
||||
(flags (:standard -w -9-32 -safe-string
|
||||
-open Tezos_base__TzPervasives
|
||||
-open Tezos_micheline
|
||||
-open Tezos_stdlib_unix)))
|
||||
-open Tezos_micheline)))
|
||||
|
||||
(alias
|
||||
(name buildtest)
|
||||
|
@ -27,6 +27,8 @@
|
||||
(* Token value *)
|
||||
(****************************************************************************)
|
||||
|
||||
open Assert.Compat
|
||||
|
||||
let assert_tokenize ~loc given expected =
|
||||
match Micheline_parser.tokenize given with
|
||||
| tokens, [] ->
|
||||
@ -454,9 +456,7 @@ let wrap (n, f) =
|
||||
Alcotest_lwt.test_case n `Quick begin fun _ () ->
|
||||
f () >>= function
|
||||
| Ok () -> Lwt.return_unit
|
||||
| Error err ->
|
||||
Tezos_stdlib_unix.Logging_unix.close () >>= fun () ->
|
||||
Lwt.fail_with (Format.asprintf "%a" pp_print_error err)
|
||||
| Error err -> Lwt.fail_with err
|
||||
end
|
||||
|
||||
let () =
|
||||
|
@ -11,6 +11,7 @@ depends: [
|
||||
"tezos-data-encoding"
|
||||
"tezos-error-monad"
|
||||
"uutf"
|
||||
"alcotest-lwt" { with-test }
|
||||
]
|
||||
build: [
|
||||
[ "dune" "build" "-p" name "-j" jobs ]
|
||||
|
Loading…
Reference in New Issue
Block a user