ligo/src/bin/expect_tests/failwith_tests.ml

37 lines
1.0 KiB
OCaml
Raw Normal View History

2020-02-06 12:05:13 +01:00
open Cli_expect
let contract basename =
"../../test/contracts/" ^ basename
let bad_contract basename =
"../../test/contracts/negative/" ^ basename
let%expect_test _ =
run_ligo_good [ "run-function" ; contract "failwith.ligo" ; "failer" ; "1" ] ;
[%expect {|
2020-04-21 15:35:41 +00:00
failwith(42) |}];
2020-02-06 12:05:13 +01:00
run_ligo_good [ "run-function" ; contract "failwith.ligo" ; "failer" ; "1" ; "--format=json" ] ;
[%expect {|
2020-04-21 15:35:41 +00:00
{"status":"ok","content":"failwith(42)"} |}];
2020-02-06 12:05:13 +01:00
run_ligo_good [ "dry-run" ; contract "subtle_nontail_fail.mligo" ; "main" ; "()" ; "()" ] ;
[%expect {|
failwith("This contract always fails") |}];
run_ligo_good [ "interpret" ; "assert(1=1)" ; "--syntax=pascaligo" ] ;
[%expect {|
2019-12-04 18:30:52 +01:00
unit |}];
2020-02-06 12:05:13 +01:00
run_ligo_good [ "interpret" ; "assert(1=2)" ; "--syntax=pascaligo" ] ;
[%expect {|
failwith("failed assertion") |}];
run_ligo_good [ "interpret" ; "assert(1=1)" ; "--syntax=cameligo" ] ;
[%expect {|
2019-12-04 18:30:52 +01:00
unit |}];
2020-02-06 12:05:13 +01:00
run_ligo_good [ "interpret" ; "assert(1=2)" ; "--syntax=cameligo" ] ;
[%expect {|
failwith("failed assertion") |}];