Merge branch 'feature/cli-tests' into 'dev'
Add some cli expect tests See merge request ligolang/ligo!215
This commit is contained in:
commit
c322ca53de
@ -84,7 +84,7 @@ local-dune-job:
|
|||||||
script:
|
script:
|
||||||
- scripts/install_vendors_deps.sh
|
- scripts/install_vendors_deps.sh
|
||||||
- scripts/build_ligo_local.sh
|
- scripts/build_ligo_local.sh
|
||||||
- dune build @ligo-test
|
- dune runtest
|
||||||
|
|
||||||
# Run a docker build without publishing to the registry
|
# Run a docker build without publishing to the registry
|
||||||
build-current-docker-image:
|
build-current-docker-image:
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
eval $(opam config env)
|
eval $(opam config env)
|
||||||
dune build @ligo-test
|
dune runtest
|
||||||
|
@ -187,8 +187,8 @@ let compile_expression =
|
|||||||
let docs = "Subcommand: compile to a michelson value." in
|
let docs = "Subcommand: compile to a michelson value." in
|
||||||
(term , Term.info ~docs cmdname)
|
(term , Term.info ~docs cmdname)
|
||||||
|
|
||||||
|
let run ?argv () =
|
||||||
let () = Term.exit @@ Term.eval_choice main [
|
Term.eval_choice ?argv main [
|
||||||
compile_file ;
|
compile_file ;
|
||||||
compile_parameter ;
|
compile_parameter ;
|
||||||
compile_storage ;
|
compile_storage ;
|
||||||
|
@ -1,27 +1,2 @@
|
|||||||
(*
|
|
||||||
open Cmdliner
|
open Cmdliner
|
||||||
|
val run : ?argv:string array -> unit -> unit Term.result
|
||||||
val main : unit Term.t * Term.info
|
|
||||||
|
|
||||||
val source : int -> string Term.t
|
|
||||||
|
|
||||||
val entry_point : int -> string Term.t
|
|
||||||
|
|
||||||
val expression : string -> int -> string Term.t
|
|
||||||
|
|
||||||
val syntax : string Term.t
|
|
||||||
|
|
||||||
val amount : string Term.t
|
|
||||||
|
|
||||||
val compile_file : unit Term.t * Term.info
|
|
||||||
|
|
||||||
val compile_parameter : unit Term.t * Term.info
|
|
||||||
|
|
||||||
val compile_storage : unit Term.t * Term.info
|
|
||||||
|
|
||||||
val dry_run : unit Term.t * Term.info
|
|
||||||
|
|
||||||
val run_function : unit Term.t * Term.info
|
|
||||||
|
|
||||||
val evaluate_value : unit Term.t * Term.info
|
|
||||||
*)
|
|
||||||
|
20
src/bin/dune
20
src/bin/dune
@ -1,11 +1,27 @@
|
|||||||
(executable
|
(library
|
||||||
(name cli)
|
(name cli)
|
||||||
(public_name ligo)
|
|
||||||
(libraries
|
(libraries
|
||||||
simple-utils
|
simple-utils
|
||||||
cmdliner
|
cmdliner
|
||||||
ligo
|
ligo
|
||||||
)
|
)
|
||||||
|
(modules cli cli_helpers)
|
||||||
|
(preprocess
|
||||||
|
(pps ppx_let)
|
||||||
|
)
|
||||||
|
(flags (:standard -open Simple_utils))
|
||||||
|
)
|
||||||
|
|
||||||
|
(executable
|
||||||
|
(name ligo)
|
||||||
|
(public_name ligo)
|
||||||
|
(libraries
|
||||||
|
simple-utils
|
||||||
|
cmdliner
|
||||||
|
ligo
|
||||||
|
cli
|
||||||
|
)
|
||||||
|
(modules ligo)
|
||||||
(package ligo)
|
(package ligo)
|
||||||
(preprocess
|
(preprocess
|
||||||
(pps ppx_let)
|
(pps ppx_let)
|
||||||
|
27
src/bin/expect_tests/cli_expect.ml
Normal file
27
src/bin/expect_tests/cli_expect.ml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
open Cmdliner
|
||||||
|
|
||||||
|
(* exit <> 0 but expected exit = 0 *)
|
||||||
|
exception Should_exit_good
|
||||||
|
|
||||||
|
(* exit = 0 but expected exit <> 0 *)
|
||||||
|
exception Should_exit_bad
|
||||||
|
|
||||||
|
(* ugh, can we avoid this? *)
|
||||||
|
let () = Unix.putenv "TERM" "dumb"
|
||||||
|
|
||||||
|
let run_ligo args =
|
||||||
|
let argv = Array.of_list ("ligo" :: args) in
|
||||||
|
let result = Cli.run ~argv () in
|
||||||
|
Term.exit_status_of_result result
|
||||||
|
|
||||||
|
let run_ligo_good args =
|
||||||
|
let exit_code = run_ligo args in
|
||||||
|
if (exit_code <> 0)
|
||||||
|
then raise Should_exit_good
|
||||||
|
else ()
|
||||||
|
|
||||||
|
let run_ligo_bad args =
|
||||||
|
let exit_code = run_ligo args in
|
||||||
|
if (exit_code = 0)
|
||||||
|
then raise Should_exit_bad
|
||||||
|
else ()
|
291
src/bin/expect_tests/contract_tests.ml
Normal file
291
src/bin/expect_tests/contract_tests.ml
Normal file
@ -0,0 +1,291 @@
|
|||||||
|
open Cli_expect
|
||||||
|
|
||||||
|
let contract basename =
|
||||||
|
"../../test/contracts/" ^ basename
|
||||||
|
|
||||||
|
let %expect_test _ =
|
||||||
|
run_ligo_good [ "compile-contract" ; contract "coase.ligo" ; "main" ] ;
|
||||||
|
[%expect {|
|
||||||
|
{ parameter
|
||||||
|
(or (or (nat %buy_single) (nat %sell_single))
|
||||||
|
(pair %transfer_single (nat %card_to_transfer) (address %destination))) ;
|
||||||
|
storage
|
||||||
|
(pair (pair (map %card_patterns nat (pair (mutez %coefficient) (nat %quantity)))
|
||||||
|
(map %cards nat (pair (address %card_owner) (nat %card_pattern))))
|
||||||
|
(nat %next_id)) ;
|
||||||
|
code { LAMBDA
|
||||||
|
(pair (pair (nat %card_to_transfer) (address %destination))
|
||||||
|
(pair (pair (map %card_patterns nat (pair (mutez %coefficient) (nat %quantity)))
|
||||||
|
(map %cards nat (pair (address %card_owner) (nat %card_pattern))))
|
||||||
|
(nat %next_id)))
|
||||||
|
(pair (list operation)
|
||||||
|
(pair (pair (map %card_patterns nat (pair (mutez %coefficient) (nat %quantity)))
|
||||||
|
(map %cards nat (pair (address %card_owner) (nat %card_pattern))))
|
||||||
|
(nat %next_id)))
|
||||||
|
{ DUP ;
|
||||||
|
CAR ;
|
||||||
|
DIP { DUP } ;
|
||||||
|
SWAP ;
|
||||||
|
CDR ;
|
||||||
|
DUP ;
|
||||||
|
CAR ;
|
||||||
|
CDR ;
|
||||||
|
DIP 2 { DUP } ;
|
||||||
|
DIG 2 ;
|
||||||
|
CAR ;
|
||||||
|
DIP { DUP } ;
|
||||||
|
GET ;
|
||||||
|
IF_NONE { PUSH string "GET_FORCE" ; FAILWITH } {} ;
|
||||||
|
DUP ;
|
||||||
|
CAR ;
|
||||||
|
SOURCE ;
|
||||||
|
SWAP ;
|
||||||
|
COMPARE ;
|
||||||
|
NEQ ;
|
||||||
|
IF { PUSH string "This card doesn't belong to you" ; FAILWITH }
|
||||||
|
{ PUSH unit Unit } ;
|
||||||
|
DROP ;
|
||||||
|
DIP 3 { DUP } ;
|
||||||
|
DIG 3 ;
|
||||||
|
CDR ;
|
||||||
|
DIP { DUP ; CDR } ;
|
||||||
|
PAIR ;
|
||||||
|
DIP { DROP } ;
|
||||||
|
DIP 3 { DUP } ;
|
||||||
|
DIG 3 ;
|
||||||
|
CAR ;
|
||||||
|
DIP { DUP ; SOME ; DIP { DIP { DUP } ; SWAP } } ;
|
||||||
|
UPDATE ;
|
||||||
|
DIP { DIP { DUP } ; SWAP ; DROP } ;
|
||||||
|
SWAP ;
|
||||||
|
DIP { DIP { DROP } ; DUP } ;
|
||||||
|
SWAP ;
|
||||||
|
DIP { DIP 2 { DUP } ; DIG 2 ; DUP ; CDR ; SWAP ; CAR ; CAR } ;
|
||||||
|
SWAP ;
|
||||||
|
PAIR ;
|
||||||
|
PAIR ;
|
||||||
|
DIP 3 { DROP } ;
|
||||||
|
DUG 2 ;
|
||||||
|
NIL operation ;
|
||||||
|
DUP ;
|
||||||
|
DIP { DIP 3 { DUP } ; DIG 3 } ;
|
||||||
|
PAIR ;
|
||||||
|
DIP { DROP 6 } } ;
|
||||||
|
LAMBDA
|
||||||
|
(pair nat
|
||||||
|
(pair (pair (map %card_patterns nat (pair (mutez %coefficient) (nat %quantity)))
|
||||||
|
(map %cards nat (pair (address %card_owner) (nat %card_pattern))))
|
||||||
|
(nat %next_id)))
|
||||||
|
(pair (list operation)
|
||||||
|
(pair (pair (map %card_patterns nat (pair (mutez %coefficient) (nat %quantity)))
|
||||||
|
(map %cards nat (pair (address %card_owner) (nat %card_pattern))))
|
||||||
|
(nat %next_id)))
|
||||||
|
{ DUP ;
|
||||||
|
CAR ;
|
||||||
|
DIP { DUP } ;
|
||||||
|
SWAP ;
|
||||||
|
CDR ;
|
||||||
|
DIP { DUP } ;
|
||||||
|
SWAP ;
|
||||||
|
DIP { DUP ; CAR ; CDR } ;
|
||||||
|
GET ;
|
||||||
|
IF_NONE { PUSH string "GET_FORCE" ; FAILWITH } {} ;
|
||||||
|
DUP ;
|
||||||
|
CAR ;
|
||||||
|
SOURCE ;
|
||||||
|
SWAP ;
|
||||||
|
COMPARE ;
|
||||||
|
NEQ ;
|
||||||
|
IF { PUSH string "This card doesn't belong to you" ; FAILWITH }
|
||||||
|
{ PUSH unit Unit } ;
|
||||||
|
DROP ;
|
||||||
|
DUP ;
|
||||||
|
CDR ;
|
||||||
|
DIP { DIP { DUP } ; SWAP ; CAR ; CAR } ;
|
||||||
|
GET ;
|
||||||
|
IF_NONE { PUSH string "GET_FORCE" ; FAILWITH } {} ;
|
||||||
|
DUP ;
|
||||||
|
CDR ;
|
||||||
|
PUSH nat 1 ;
|
||||||
|
SWAP ;
|
||||||
|
SUB ;
|
||||||
|
ABS ;
|
||||||
|
DIP { DUP ; CAR } ;
|
||||||
|
SWAP ;
|
||||||
|
PAIR ;
|
||||||
|
DIP { DROP } ;
|
||||||
|
DIP 2 { DUP } ;
|
||||||
|
DIG 2 ;
|
||||||
|
CAR ;
|
||||||
|
CAR ;
|
||||||
|
DIP 2 { DUP } ;
|
||||||
|
DIG 2 ;
|
||||||
|
CDR ;
|
||||||
|
DIP { DIP { DUP } ; SWAP ; SOME ; DIP { DUP } } ;
|
||||||
|
UPDATE ;
|
||||||
|
DIP { DROP } ;
|
||||||
|
DUP ;
|
||||||
|
DIP { DIP 3 { DUP } ; DIG 3 ; DUP ; CDR ; SWAP ; CAR ; CDR } ;
|
||||||
|
PAIR ;
|
||||||
|
PAIR ;
|
||||||
|
DIP 4 { DROP } ;
|
||||||
|
DUG 3 ;
|
||||||
|
DIP 3 { DUP } ;
|
||||||
|
DIG 3 ;
|
||||||
|
CAR ;
|
||||||
|
CDR ;
|
||||||
|
DIP 5 { DUP } ;
|
||||||
|
DIG 5 ;
|
||||||
|
DIP { DUP ; NONE (pair (address %card_owner) (nat %card_pattern)) } ;
|
||||||
|
UPDATE ;
|
||||||
|
DIP { DROP } ;
|
||||||
|
DUP ;
|
||||||
|
DIP { DIP 4 { DUP } ; DIG 4 ; DUP ; CDR ; SWAP ; CAR ; CAR } ;
|
||||||
|
SWAP ;
|
||||||
|
PAIR ;
|
||||||
|
PAIR ;
|
||||||
|
DIP 5 { DROP } ;
|
||||||
|
DUG 4 ;
|
||||||
|
DIP 2 { DUP } ;
|
||||||
|
DIG 2 ;
|
||||||
|
CAR ;
|
||||||
|
DIP { DIP 2 { DUP } ; DIG 2 ; CDR } ;
|
||||||
|
MUL ;
|
||||||
|
SOURCE ;
|
||||||
|
CONTRACT unit ;
|
||||||
|
IF_NONE { PUSH string "bad address for get_contract" ; FAILWITH } {} ;
|
||||||
|
DIP { DUP } ;
|
||||||
|
SWAP ;
|
||||||
|
DIP { DUP } ;
|
||||||
|
UNIT ;
|
||||||
|
TRANSFER_TOKENS ;
|
||||||
|
DUP ;
|
||||||
|
NIL operation ;
|
||||||
|
SWAP ;
|
||||||
|
CONS ;
|
||||||
|
DUP ;
|
||||||
|
DIP { DIP 8 { DUP } ; DIG 8 } ;
|
||||||
|
PAIR ;
|
||||||
|
DIP { DROP 11 } } ;
|
||||||
|
LAMBDA
|
||||||
|
(pair nat
|
||||||
|
(pair (pair (map %card_patterns nat (pair (mutez %coefficient) (nat %quantity)))
|
||||||
|
(map %cards nat (pair (address %card_owner) (nat %card_pattern))))
|
||||||
|
(nat %next_id)))
|
||||||
|
(pair (list operation)
|
||||||
|
(pair (pair (map %card_patterns nat (pair (mutez %coefficient) (nat %quantity)))
|
||||||
|
(map %cards nat (pair (address %card_owner) (nat %card_pattern))))
|
||||||
|
(nat %next_id)))
|
||||||
|
{ DUP ;
|
||||||
|
CAR ;
|
||||||
|
DIP { DUP } ;
|
||||||
|
SWAP ;
|
||||||
|
CDR ;
|
||||||
|
DIP { DUP } ;
|
||||||
|
SWAP ;
|
||||||
|
DIP { DUP ; CAR ; CAR } ;
|
||||||
|
GET ;
|
||||||
|
IF_NONE { PUSH string "GET_FORCE" ; FAILWITH } {} ;
|
||||||
|
DUP ;
|
||||||
|
CAR ;
|
||||||
|
DIP { DUP ; CDR ; PUSH nat 1 ; ADD } ;
|
||||||
|
MUL ;
|
||||||
|
DUP ;
|
||||||
|
AMOUNT ;
|
||||||
|
SWAP ;
|
||||||
|
COMPARE ;
|
||||||
|
GT ;
|
||||||
|
IF { PUSH string "Not enough money" ; FAILWITH } { PUSH unit Unit } ;
|
||||||
|
DROP ;
|
||||||
|
NIL operation ;
|
||||||
|
DIP 2 { DUP } ;
|
||||||
|
DIG 2 ;
|
||||||
|
CDR ;
|
||||||
|
PUSH nat 1 ;
|
||||||
|
ADD ;
|
||||||
|
DIP { DIP 2 { DUP } ; DIG 2 ; CAR } ;
|
||||||
|
SWAP ;
|
||||||
|
PAIR ;
|
||||||
|
DIP 3 { DROP } ;
|
||||||
|
DUG 2 ;
|
||||||
|
DIP 3 { DUP } ;
|
||||||
|
DIG 3 ;
|
||||||
|
CAR ;
|
||||||
|
CAR ;
|
||||||
|
DIP 5 { DUP } ;
|
||||||
|
DIG 5 ;
|
||||||
|
DIP { DIP 3 { DUP } ; DIG 3 ; SOME ; DIP { DUP } } ;
|
||||||
|
UPDATE ;
|
||||||
|
DIP { DROP } ;
|
||||||
|
DUP ;
|
||||||
|
DIP { DIP 4 { DUP } ; DIG 4 ; DUP ; CDR ; SWAP ; CAR ; CDR } ;
|
||||||
|
PAIR ;
|
||||||
|
PAIR ;
|
||||||
|
DIP 5 { DROP } ;
|
||||||
|
DUG 4 ;
|
||||||
|
DIP 4 { DUP } ;
|
||||||
|
DIG 4 ;
|
||||||
|
CAR ;
|
||||||
|
CDR ;
|
||||||
|
DIP 5 { DUP } ;
|
||||||
|
DIG 5 ;
|
||||||
|
CDR ;
|
||||||
|
DIP { DIP 6 { DUP } ; DIG 6 ; SOURCE ; PAIR ; SOME ; DIP { DUP } } ;
|
||||||
|
UPDATE ;
|
||||||
|
DIP { DROP } ;
|
||||||
|
DUP ;
|
||||||
|
DIP { DIP 5 { DUP } ; DIG 5 ; DUP ; CDR ; SWAP ; CAR ; CAR } ;
|
||||||
|
SWAP ;
|
||||||
|
PAIR ;
|
||||||
|
PAIR ;
|
||||||
|
DIP 6 { DROP } ;
|
||||||
|
DUG 5 ;
|
||||||
|
DIP 5 { DUP } ;
|
||||||
|
DIG 5 ;
|
||||||
|
CDR ;
|
||||||
|
PUSH nat 1 ;
|
||||||
|
ADD ;
|
||||||
|
DIP { DIP 5 { DUP } ; DIG 5 ; CAR } ;
|
||||||
|
SWAP ;
|
||||||
|
PAIR ;
|
||||||
|
DIP 6 { DROP } ;
|
||||||
|
DUG 5 ;
|
||||||
|
DIP 2 { DUP } ;
|
||||||
|
DIG 2 ;
|
||||||
|
DIP { DIP 5 { DUP } ; DIG 5 } ;
|
||||||
|
PAIR ;
|
||||||
|
DIP { DROP 8 } } ;
|
||||||
|
DIP 3 { DUP } ;
|
||||||
|
DIG 3 ;
|
||||||
|
CAR ;
|
||||||
|
DIP 4 { DUP } ;
|
||||||
|
DIG 4 ;
|
||||||
|
CDR ;
|
||||||
|
DIP { DUP } ;
|
||||||
|
SWAP ;
|
||||||
|
IF_LEFT
|
||||||
|
{ DUP ;
|
||||||
|
IF_LEFT
|
||||||
|
{ DUP ;
|
||||||
|
DUP ;
|
||||||
|
DIP { DIP 3 { DUP } ; DIG 3 } ;
|
||||||
|
PAIR ;
|
||||||
|
DIP { DIP 5 { DUP } ; DIG 5 } ;
|
||||||
|
EXEC ;
|
||||||
|
DIP { DROP 2 } }
|
||||||
|
{ DUP ;
|
||||||
|
DUP ;
|
||||||
|
DIP { DIP 3 { DUP } ; DIG 3 } ;
|
||||||
|
PAIR ;
|
||||||
|
DIP { DIP 6 { DUP } ; DIG 6 } ;
|
||||||
|
EXEC ;
|
||||||
|
DIP { DROP 2 } } ;
|
||||||
|
DIP { DROP } }
|
||||||
|
{ DUP ;
|
||||||
|
DUP ;
|
||||||
|
DIP { DIP 2 { DUP } ; DIG 2 } ;
|
||||||
|
PAIR ;
|
||||||
|
DIP { DIP 6 { DUP } ; DIG 6 } ;
|
||||||
|
EXEC ;
|
||||||
|
DIP { DROP 2 } } ;
|
||||||
|
DIP { DROP 6 } } } |} ] ;
|
6
src/bin/expect_tests/dune
Normal file
6
src/bin/expect_tests/dune
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
(library
|
||||||
|
(name cli_expect_tests)
|
||||||
|
(libraries simple-utils cli)
|
||||||
|
(inline_tests)
|
||||||
|
(preprocess (pps ppx_let ppx_expect))
|
||||||
|
(flags (:standard -open Simple_utils)))
|
362
src/bin/expect_tests/help_tests.ml
Normal file
362
src/bin/expect_tests/help_tests.ml
Normal file
@ -0,0 +1,362 @@
|
|||||||
|
open Cli_expect
|
||||||
|
|
||||||
|
let%expect_test _ =
|
||||||
|
(* TODO good? *)
|
||||||
|
run_ligo_good [] ;
|
||||||
|
[%expect {| Ligo needs a command. Do ligo --help |} ] ;
|
||||||
|
|
||||||
|
run_ligo_good [ "--help" ] ;
|
||||||
|
[%expect {|
|
||||||
|
NAME
|
||||||
|
ligo
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
ligo COMMAND ...
|
||||||
|
|
||||||
|
Subcommand: compile a contract. See `ligo compile-contract --help' for a list
|
||||||
|
of options specific to this subcommand.
|
||||||
|
compile-contract
|
||||||
|
|
||||||
|
|
||||||
|
Subcommand: compile an initial storage in ligo syntax to a michelson
|
||||||
|
expression. The resulting michelson expression can be passed as an argument
|
||||||
|
in a transaction which originates a contract. See `ligo compile-storage
|
||||||
|
--help' for a list of options specific to this subcommand.
|
||||||
|
compile-storage
|
||||||
|
|
||||||
|
|
||||||
|
Subcommand: compile parameters to a michelson expression. The resulting
|
||||||
|
michelson expression can be passed as an argument in a transaction which
|
||||||
|
calls a contract. See `ligo compile-parameter --help' for a list of options
|
||||||
|
specific to this subcommand.
|
||||||
|
compile-parameter
|
||||||
|
|
||||||
|
|
||||||
|
Subcommand: compile to a michelson value.
|
||||||
|
compile-expression
|
||||||
|
|
||||||
|
|
||||||
|
Subcommand: evaluate a given definition.
|
||||||
|
evaluate-value
|
||||||
|
|
||||||
|
|
||||||
|
Subcommand: run a function with the given parameter.
|
||||||
|
run-function
|
||||||
|
|
||||||
|
|
||||||
|
Subcommand: run a smart-contract with the given storage and input.
|
||||||
|
dry-run
|
||||||
|
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
--help[=FMT] (default=auto)
|
||||||
|
Show this help in format FMT. The value FMT must be one of `auto',
|
||||||
|
`pager', `groff' or `plain'. With `auto', the format is `pager` or
|
||||||
|
`plain' whenever the TERM env var is `dumb' or undefined. |} ] ;
|
||||||
|
|
||||||
|
run_ligo_good [ "compile-contract" ; "--help" ] ;
|
||||||
|
[%expect {|
|
||||||
|
NAME
|
||||||
|
ligo-compile-contract
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
ligo compile-contract [OPTION]... SOURCE_FILE ENTRY_POINT
|
||||||
|
|
||||||
|
ARGUMENTS
|
||||||
|
ENTRY_POINT (required)
|
||||||
|
ENTRY_POINT is entry-point that will be compiled.
|
||||||
|
|
||||||
|
SOURCE_FILE (required)
|
||||||
|
SOURCE_FILE is the path to the .ligo or .mligo file of the
|
||||||
|
contract.
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
--format=DISPLAY_FORMAT, --display-format=DISPLAY_FORMAT
|
||||||
|
(absent=human-readable)
|
||||||
|
DISPLAY_FORMAT is the format that will be used by the CLI.
|
||||||
|
Available formats are 'dev', 'json', and 'human-readable'
|
||||||
|
(default). When human-readable lacks details (we are still
|
||||||
|
tweaking it), please contact us and use another format in the
|
||||||
|
meanwhile.
|
||||||
|
|
||||||
|
--help[=FMT] (default=auto)
|
||||||
|
Show this help in format FMT. The value FMT must be one of `auto',
|
||||||
|
`pager', `groff' or `plain'. With `auto', the format is `pager` or
|
||||||
|
`plain' whenever the TERM env var is `dumb' or undefined.
|
||||||
|
|
||||||
|
--michelson-format=MICHELSON_FORMAT (absent=text)
|
||||||
|
MICHELSON_FORMAT is the format that will be used by
|
||||||
|
compile-contract for the resulting Michelson. Available formats
|
||||||
|
are 'text' (default), 'json' and 'hex'.
|
||||||
|
|
||||||
|
-s SYNTAX, --syntax=SYNTAX (absent=auto)
|
||||||
|
SYNTAX is the syntax that will be used. Currently supported
|
||||||
|
syntaxes are "pascaligo" and "cameligo". By default, the syntax is
|
||||||
|
guessed from the extension (.ligo and .mligo, respectively). |} ] ;
|
||||||
|
|
||||||
|
run_ligo_good [ "compile-parameter" ; "--help" ] ;
|
||||||
|
[%expect {|
|
||||||
|
NAME
|
||||||
|
ligo-compile-parameter
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
ligo compile-parameter [OPTION]... SOURCE_FILE ENTRY_POINT
|
||||||
|
PARAMETER_EXPRESSION
|
||||||
|
|
||||||
|
ARGUMENTS
|
||||||
|
ENTRY_POINT (required)
|
||||||
|
ENTRY_POINT is entry-point that will be compiled.
|
||||||
|
|
||||||
|
PARAMETER_EXPRESSION (required)
|
||||||
|
PARAMETER_EXPRESSION is the expression that will be compiled.
|
||||||
|
|
||||||
|
SOURCE_FILE (required)
|
||||||
|
SOURCE_FILE is the path to the .ligo or .mligo file of the
|
||||||
|
contract.
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
--format=DISPLAY_FORMAT, --display-format=DISPLAY_FORMAT
|
||||||
|
(absent=human-readable)
|
||||||
|
DISPLAY_FORMAT is the format that will be used by the CLI.
|
||||||
|
Available formats are 'dev', 'json', and 'human-readable'
|
||||||
|
(default). When human-readable lacks details (we are still
|
||||||
|
tweaking it), please contact us and use another format in the
|
||||||
|
meanwhile.
|
||||||
|
|
||||||
|
--help[=FMT] (default=auto)
|
||||||
|
Show this help in format FMT. The value FMT must be one of `auto',
|
||||||
|
`pager', `groff' or `plain'. With `auto', the format is `pager` or
|
||||||
|
`plain' whenever the TERM env var is `dumb' or undefined.
|
||||||
|
|
||||||
|
--michelson-format=MICHELSON_FORMAT (absent=text)
|
||||||
|
MICHELSON_FORMAT is the format that will be used by
|
||||||
|
compile-contract for the resulting Michelson. Available formats
|
||||||
|
are 'text' (default), 'json' and 'hex'.
|
||||||
|
|
||||||
|
-s SYNTAX, --syntax=SYNTAX (absent=auto)
|
||||||
|
SYNTAX is the syntax that will be used. Currently supported
|
||||||
|
syntaxes are "pascaligo" and "cameligo". By default, the syntax is
|
||||||
|
guessed from the extension (.ligo and .mligo, respectively). |} ] ;
|
||||||
|
|
||||||
|
run_ligo_good [ "compile-storage" ; "--help" ] ;
|
||||||
|
[%expect {|
|
||||||
|
NAME
|
||||||
|
ligo-compile-storage
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
ligo compile-storage [OPTION]... SOURCE_FILE ENTRY_POINT
|
||||||
|
STORAGE_EXPRESSION
|
||||||
|
|
||||||
|
ARGUMENTS
|
||||||
|
ENTRY_POINT (required)
|
||||||
|
ENTRY_POINT is entry-point that will be compiled.
|
||||||
|
|
||||||
|
SOURCE_FILE (required)
|
||||||
|
SOURCE_FILE is the path to the .ligo or .mligo file of the
|
||||||
|
contract.
|
||||||
|
|
||||||
|
STORAGE_EXPRESSION (required)
|
||||||
|
STORAGE_EXPRESSION is the expression that will be compiled.
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
--format=DISPLAY_FORMAT, --display-format=DISPLAY_FORMAT
|
||||||
|
(absent=human-readable)
|
||||||
|
DISPLAY_FORMAT is the format that will be used by the CLI.
|
||||||
|
Available formats are 'dev', 'json', and 'human-readable'
|
||||||
|
(default). When human-readable lacks details (we are still
|
||||||
|
tweaking it), please contact us and use another format in the
|
||||||
|
meanwhile.
|
||||||
|
|
||||||
|
--help[=FMT] (default=auto)
|
||||||
|
Show this help in format FMT. The value FMT must be one of `auto',
|
||||||
|
`pager', `groff' or `plain'. With `auto', the format is `pager` or
|
||||||
|
`plain' whenever the TERM env var is `dumb' or undefined.
|
||||||
|
|
||||||
|
--michelson-format=MICHELSON_FORMAT (absent=text)
|
||||||
|
MICHELSON_FORMAT is the format that will be used by
|
||||||
|
compile-contract for the resulting Michelson. Available formats
|
||||||
|
are 'text' (default), 'json' and 'hex'.
|
||||||
|
|
||||||
|
-s SYNTAX, --syntax=SYNTAX (absent=auto)
|
||||||
|
SYNTAX is the syntax that will be used. Currently supported
|
||||||
|
syntaxes are "pascaligo" and "cameligo". By default, the syntax is
|
||||||
|
guessed from the extension (.ligo and .mligo, respectively). |} ] ;
|
||||||
|
|
||||||
|
run_ligo_good [ "dry-run" ; "--help" ] ;
|
||||||
|
[%expect {|
|
||||||
|
NAME
|
||||||
|
ligo-dry-run
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
ligo dry-run [OPTION]... SOURCE_FILE ENTRY_POINT PARAMETER_EXPRESSION
|
||||||
|
STORAGE_EXPRESSION
|
||||||
|
|
||||||
|
ARGUMENTS
|
||||||
|
ENTRY_POINT (required)
|
||||||
|
ENTRY_POINT is entry-point that will be compiled.
|
||||||
|
|
||||||
|
PARAMETER_EXPRESSION (required)
|
||||||
|
PARAMETER_EXPRESSION is the expression that will be compiled.
|
||||||
|
|
||||||
|
SOURCE_FILE (required)
|
||||||
|
SOURCE_FILE is the path to the .ligo or .mligo file of the
|
||||||
|
contract.
|
||||||
|
|
||||||
|
STORAGE_EXPRESSION (required)
|
||||||
|
STORAGE_EXPRESSION is the expression that will be compiled.
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
--amount=AMOUNT (absent=0)
|
||||||
|
AMOUNT is the amount the dry-run transaction will use.
|
||||||
|
|
||||||
|
--format=DISPLAY_FORMAT, --display-format=DISPLAY_FORMAT
|
||||||
|
(absent=human-readable)
|
||||||
|
DISPLAY_FORMAT is the format that will be used by the CLI.
|
||||||
|
Available formats are 'dev', 'json', and 'human-readable'
|
||||||
|
(default). When human-readable lacks details (we are still
|
||||||
|
tweaking it), please contact us and use another format in the
|
||||||
|
meanwhile.
|
||||||
|
|
||||||
|
--help[=FMT] (default=auto)
|
||||||
|
Show this help in format FMT. The value FMT must be one of `auto',
|
||||||
|
`pager', `groff' or `plain'. With `auto', the format is `pager` or
|
||||||
|
`plain' whenever the TERM env var is `dumb' or undefined.
|
||||||
|
|
||||||
|
-s SYNTAX, --syntax=SYNTAX (absent=auto)
|
||||||
|
SYNTAX is the syntax that will be used. Currently supported
|
||||||
|
syntaxes are "pascaligo" and "cameligo". By default, the syntax is
|
||||||
|
guessed from the extension (.ligo and .mligo, respectively).
|
||||||
|
|
||||||
|
--sender=SENDER
|
||||||
|
SENDER is the sender the dry-run transaction will use.
|
||||||
|
|
||||||
|
--source=SOURCE
|
||||||
|
SOURCE is the source the dry-run transaction will use. |} ] ;
|
||||||
|
|
||||||
|
run_ligo_good [ "run-function" ; "--help" ] ;
|
||||||
|
[%expect {|
|
||||||
|
NAME
|
||||||
|
ligo-run-function
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
ligo run-function [OPTION]... SOURCE_FILE ENTRY_POINT
|
||||||
|
PARAMETER_EXPRESSION
|
||||||
|
|
||||||
|
ARGUMENTS
|
||||||
|
ENTRY_POINT (required)
|
||||||
|
ENTRY_POINT is entry-point that will be compiled.
|
||||||
|
|
||||||
|
PARAMETER_EXPRESSION (required)
|
||||||
|
PARAMETER_EXPRESSION is the expression that will be compiled.
|
||||||
|
|
||||||
|
SOURCE_FILE (required)
|
||||||
|
SOURCE_FILE is the path to the .ligo or .mligo file of the
|
||||||
|
contract.
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
--amount=AMOUNT (absent=0)
|
||||||
|
AMOUNT is the amount the dry-run transaction will use.
|
||||||
|
|
||||||
|
--format=DISPLAY_FORMAT, --display-format=DISPLAY_FORMAT
|
||||||
|
(absent=human-readable)
|
||||||
|
DISPLAY_FORMAT is the format that will be used by the CLI.
|
||||||
|
Available formats are 'dev', 'json', and 'human-readable'
|
||||||
|
(default). When human-readable lacks details (we are still
|
||||||
|
tweaking it), please contact us and use another format in the
|
||||||
|
meanwhile.
|
||||||
|
|
||||||
|
--help[=FMT] (default=auto)
|
||||||
|
Show this help in format FMT. The value FMT must be one of `auto',
|
||||||
|
`pager', `groff' or `plain'. With `auto', the format is `pager` or
|
||||||
|
`plain' whenever the TERM env var is `dumb' or undefined.
|
||||||
|
|
||||||
|
-s SYNTAX, --syntax=SYNTAX (absent=auto)
|
||||||
|
SYNTAX is the syntax that will be used. Currently supported
|
||||||
|
syntaxes are "pascaligo" and "cameligo". By default, the syntax is
|
||||||
|
guessed from the extension (.ligo and .mligo, respectively).
|
||||||
|
|
||||||
|
--sender=SENDER
|
||||||
|
SENDER is the sender the dry-run transaction will use.
|
||||||
|
|
||||||
|
--source=SOURCE
|
||||||
|
SOURCE is the source the dry-run transaction will use. |} ] ;
|
||||||
|
|
||||||
|
run_ligo_good [ "evaluate-value" ; "--help" ] ;
|
||||||
|
[%expect {|
|
||||||
|
NAME
|
||||||
|
ligo-evaluate-value
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
ligo evaluate-value [OPTION]... SOURCE_FILE ENTRY_POINT
|
||||||
|
|
||||||
|
ARGUMENTS
|
||||||
|
ENTRY_POINT (required)
|
||||||
|
ENTRY_POINT is entry-point that will be compiled.
|
||||||
|
|
||||||
|
SOURCE_FILE (required)
|
||||||
|
SOURCE_FILE is the path to the .ligo or .mligo file of the
|
||||||
|
contract.
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
--amount=AMOUNT (absent=0)
|
||||||
|
AMOUNT is the amount the dry-run transaction will use.
|
||||||
|
|
||||||
|
--format=DISPLAY_FORMAT, --display-format=DISPLAY_FORMAT
|
||||||
|
(absent=human-readable)
|
||||||
|
DISPLAY_FORMAT is the format that will be used by the CLI.
|
||||||
|
Available formats are 'dev', 'json', and 'human-readable'
|
||||||
|
(default). When human-readable lacks details (we are still
|
||||||
|
tweaking it), please contact us and use another format in the
|
||||||
|
meanwhile.
|
||||||
|
|
||||||
|
--help[=FMT] (default=auto)
|
||||||
|
Show this help in format FMT. The value FMT must be one of `auto',
|
||||||
|
`pager', `groff' or `plain'. With `auto', the format is `pager` or
|
||||||
|
`plain' whenever the TERM env var is `dumb' or undefined.
|
||||||
|
|
||||||
|
-s SYNTAX, --syntax=SYNTAX (absent=auto)
|
||||||
|
SYNTAX is the syntax that will be used. Currently supported
|
||||||
|
syntaxes are "pascaligo" and "cameligo". By default, the syntax is
|
||||||
|
guessed from the extension (.ligo and .mligo, respectively).
|
||||||
|
|
||||||
|
--sender=SENDER
|
||||||
|
SENDER is the sender the dry-run transaction will use.
|
||||||
|
|
||||||
|
--source=SOURCE
|
||||||
|
SOURCE is the source the dry-run transaction will use. |} ] ;
|
||||||
|
|
||||||
|
run_ligo_good [ "compile-expression" ; "--help" ] ;
|
||||||
|
[%expect {|
|
||||||
|
NAME
|
||||||
|
ligo-compile-expression
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
ligo compile-expression [OPTION]... _EXPRESSION
|
||||||
|
|
||||||
|
ARGUMENTS
|
||||||
|
_EXPRESSION (required)
|
||||||
|
_EXPRESSION is the expression that will be compiled.
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
--format=DISPLAY_FORMAT, --display-format=DISPLAY_FORMAT
|
||||||
|
(absent=human-readable)
|
||||||
|
DISPLAY_FORMAT is the format that will be used by the CLI.
|
||||||
|
Available formats are 'dev', 'json', and 'human-readable'
|
||||||
|
(default). When human-readable lacks details (we are still
|
||||||
|
tweaking it), please contact us and use another format in the
|
||||||
|
meanwhile.
|
||||||
|
|
||||||
|
--help[=FMT] (default=auto)
|
||||||
|
Show this help in format FMT. The value FMT must be one of `auto',
|
||||||
|
`pager', `groff' or `plain'. With `auto', the format is `pager` or
|
||||||
|
`plain' whenever the TERM env var is `dumb' or undefined.
|
||||||
|
|
||||||
|
--michelson-format=MICHELSON_FORMAT (absent=text)
|
||||||
|
MICHELSON_FORMAT is the format that will be used by
|
||||||
|
compile-contract for the resulting Michelson. Available formats
|
||||||
|
are 'text' (default), 'json' and 'hex'.
|
||||||
|
|
||||||
|
-s SYNTAX, --syntax=SYNTAX (absent=auto)
|
||||||
|
SYNTAX is the syntax that will be used. Currently supported
|
||||||
|
syntaxes are "pascaligo" and "cameligo". By default, the syntax is
|
||||||
|
guessed from the extension (.ligo and .mligo, respectively). |} ] ;
|
3
src/bin/ligo.ml
Normal file
3
src/bin/ligo.ml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
open Cmdliner
|
||||||
|
|
||||||
|
let () = Term.exit @@ Cli.run ()
|
@ -13,6 +13,7 @@ depends: [
|
|||||||
"menhir" { = "20190626" }
|
"menhir" { = "20190626" }
|
||||||
"ppx_let"
|
"ppx_let"
|
||||||
"ppx_deriving"
|
"ppx_deriving"
|
||||||
|
"ppx_expect"
|
||||||
"tezos-utils"
|
"tezos-utils"
|
||||||
"proto-alpha-utils"
|
"proto-alpha-utils"
|
||||||
"yojson"
|
"yojson"
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
;; (flags (:standard -w +1..62-4-9-44-40-42-48-30@39@33 -open Simple_utils ))
|
;; (flags (:standard -w +1..62-4-9-44-40-42-48-30@39@33 -open Simple_utils ))
|
||||||
)
|
)
|
||||||
|
|
||||||
(test
|
;;; TODO test does not test anything, only prints
|
||||||
(modules PartitionMain)
|
; (test
|
||||||
(libraries union_find)
|
; (modules PartitionMain)
|
||||||
(name PartitionMain))
|
; (libraries union_find)
|
||||||
|
; (name PartitionMain))
|
||||||
|
7
vendors/ligo-utils/tezos-protocol-alpha/dune
vendored
7
vendors/ligo-utils/tezos-protocol-alpha/dune
vendored
@ -15,6 +15,7 @@
|
|||||||
(name runtest_dune_template)
|
(name runtest_dune_template)
|
||||||
(action (diff dune.inc dune.inc.gen)))
|
(action (diff dune.inc dune.inc.gen)))
|
||||||
|
|
||||||
(alias
|
;;; for ligo, don't test this
|
||||||
(name runtest)
|
; (alias
|
||||||
(deps (alias runtest_dune_template)))
|
; (name runtest)
|
||||||
|
; (deps (alias runtest_dune_template)))
|
||||||
|
Loading…
Reference in New Issue
Block a user