diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2aa87413e..fa78f2b42 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -84,7 +84,7 @@ local-dune-job: script: - scripts/install_vendors_deps.sh - scripts/build_ligo_local.sh - - dune build @ligo-test + - dune runtest # Run a docker build without publishing to the registry build-current-docker-image: diff --git a/scripts/test_ligo.sh b/scripts/test_ligo.sh index 9fd6320e7..cbd3dd817 100755 --- a/scripts/test_ligo.sh +++ b/scripts/test_ligo.sh @@ -2,4 +2,4 @@ set -e eval $(opam config env) -dune build @ligo-test +dune runtest diff --git a/src/bin/cli.ml b/src/bin/cli.ml index f3f552865..4b8245e73 100644 --- a/src/bin/cli.ml +++ b/src/bin/cli.ml @@ -187,8 +187,8 @@ let compile_expression = let docs = "Subcommand: compile to a michelson value." in (term , Term.info ~docs cmdname) - -let () = Term.exit @@ Term.eval_choice main [ +let run ?argv () = + Term.eval_choice ?argv main [ compile_file ; compile_parameter ; compile_storage ; diff --git a/src/bin/cli.mli b/src/bin/cli.mli index 7b2c6ac42..93c89fc3a 100644 --- a/src/bin/cli.mli +++ b/src/bin/cli.mli @@ -1,27 +1,2 @@ -(* open Cmdliner - -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 -*) +val run : ?argv:string array -> unit -> unit Term.result diff --git a/src/bin/dune b/src/bin/dune index 1e08c1acf..5c7e1ee88 100644 --- a/src/bin/dune +++ b/src/bin/dune @@ -1,11 +1,27 @@ -(executable +(library (name cli) - (public_name ligo) (libraries simple-utils cmdliner 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) (preprocess (pps ppx_let) diff --git a/src/bin/expect_tests/cli_expect.ml b/src/bin/expect_tests/cli_expect.ml new file mode 100644 index 000000000..7006d2124 --- /dev/null +++ b/src/bin/expect_tests/cli_expect.ml @@ -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 () diff --git a/src/bin/expect_tests/contract_tests.ml b/src/bin/expect_tests/contract_tests.ml new file mode 100644 index 000000000..fef145694 --- /dev/null +++ b/src/bin/expect_tests/contract_tests.ml @@ -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 } } } |} ] ; diff --git a/src/bin/expect_tests/dune b/src/bin/expect_tests/dune new file mode 100644 index 000000000..c7856e438 --- /dev/null +++ b/src/bin/expect_tests/dune @@ -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))) diff --git a/src/bin/expect_tests/help_tests.ml b/src/bin/expect_tests/help_tests.ml new file mode 100644 index 000000000..c16365feb --- /dev/null +++ b/src/bin/expect_tests/help_tests.ml @@ -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). |} ] ; diff --git a/src/bin/ligo.ml b/src/bin/ligo.ml new file mode 100644 index 000000000..8dc3dd4d8 --- /dev/null +++ b/src/bin/ligo.ml @@ -0,0 +1,3 @@ +open Cmdliner + +let () = Term.exit @@ Cli.run () diff --git a/src/ligo.opam b/src/ligo.opam index 51e7c4a8a..303135cdb 100644 --- a/src/ligo.opam +++ b/src/ligo.opam @@ -13,6 +13,7 @@ depends: [ "menhir" { = "20190626" } "ppx_let" "ppx_deriving" + "ppx_expect" "tezos-utils" "proto-alpha-utils" "yojson" diff --git a/src/union_find/dune b/src/union_find/dune index fad355c7a..711614f28 100644 --- a/src/union_find/dune +++ b/src/union_find/dune @@ -10,7 +10,8 @@ ;; (flags (:standard -w +1..62-4-9-44-40-42-48-30@39@33 -open Simple_utils )) ) -(test - (modules PartitionMain) - (libraries union_find) - (name PartitionMain)) +;;; TODO test does not test anything, only prints +; (test +; (modules PartitionMain) +; (libraries union_find) +; (name PartitionMain)) diff --git a/vendors/ligo-utils/tezos-protocol-alpha/dune b/vendors/ligo-utils/tezos-protocol-alpha/dune index a715d55fd..44d2e1515 100644 --- a/vendors/ligo-utils/tezos-protocol-alpha/dune +++ b/vendors/ligo-utils/tezos-protocol-alpha/dune @@ -15,6 +15,7 @@ (name runtest_dune_template) (action (diff dune.inc dune.inc.gen))) -(alias - (name runtest) - (deps (alias runtest_dune_template))) +;;; for ligo, don't test this +; (alias +; (name runtest) +; (deps (alias runtest_dune_template)))