2020-03-30 15:20:14 +04:00
|
|
|
open Cli_expect
|
|
|
|
|
|
|
|
let contract basename =
|
|
|
|
"../../test/contracts/" ^ basename
|
|
|
|
let bad_contract basename =
|
|
|
|
"../../test/contracts/negative/" ^ basename
|
|
|
|
|
|
|
|
let%expect_test _ =
|
|
|
|
run_ligo_good [ "dry-run" ; contract "double_michelson_or.mligo" ; "main" ; "unit" ; "(M_left (1) : storage)" ] ;
|
|
|
|
[%expect {| ( LIST_EMPTY() , M_right("one") ) |}];
|
|
|
|
|
|
|
|
run_ligo_good [ "dry-run" ; contract "double_michelson_or.ligo" ; "main" ; "unit" ; "(M_left (1) : storage)" ] ;
|
|
|
|
[%expect {| ( LIST_EMPTY() , M_right("one") ) |}]
|
|
|
|
|
|
|
|
|
|
|
|
let%expect_test _ =
|
|
|
|
run_ligo_good [ "compile-contract" ; contract "michelson_or_tree.mligo" ; "main" ] ;
|
|
|
|
[%expect {|
|
|
|
|
{ parameter unit ;
|
2020-04-18 02:13:50 +04:00
|
|
|
storage (or (int %three) (or %four (int %one) (nat %two))) ;
|
2020-03-30 15:20:14 +04:00
|
|
|
code { PUSH int 1 ;
|
|
|
|
LEFT nat ;
|
|
|
|
RIGHT int ;
|
|
|
|
DUP ;
|
|
|
|
NIL operation ;
|
|
|
|
PAIR ;
|
|
|
|
DIP { DROP 2 } } } |}]
|
|
|
|
|
|
|
|
let%expect_test _ =
|
|
|
|
run_ligo_bad [ "compile-contract" ; bad_contract "bad_michelson_or.mligo" ; "main" ] ;
|
|
|
|
[%expect {|
|
|
|
|
ligo: in file "bad_michelson_or.mligo", line 6, characters 12-27. michelson_or types must be annotated: {"constructor":"M_right","location":"in file \"bad_michelson_or.mligo\", line 6, characters 12-27"}
|
|
|
|
|
|
|
|
|
|
|
|
If you're not sure how to fix this error, you can
|
|
|
|
do one of the following:
|
|
|
|
|
2020-04-15 17:44:30 +04:00
|
|
|
* Visit our documentation: https://ligolang.org/docs/intro/introduction
|
2020-03-30 15:20:14 +04:00
|
|
|
* Ask a question on our Discord: https://discord.gg/9rhYaEt
|
|
|
|
* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new
|
2020-04-20 22:21:49 +04:00
|
|
|
* Check the changelog by running 'ligo changelog' |}]
|
|
|
|
|
|
|
|
let%expect_test _ =
|
|
|
|
run_ligo_good [ "compile-contract" ; contract "michelson_or_tree_intermediary.ligo" ; "main" ] ;
|
|
|
|
[%expect {|
|
|
|
|
{ parameter unit ;
|
|
|
|
storage (or (int %three) (or (int %one) (nat %two))) ;
|
|
|
|
code { PUSH int 1 ;
|
|
|
|
LEFT nat ;
|
|
|
|
RIGHT int ;
|
|
|
|
DUP ;
|
|
|
|
NIL operation ;
|
|
|
|
PAIR ;
|
|
|
|
DIP { DROP 2 } } } |}]
|