Test closures more

This commit is contained in:
Tom Jack 2019-08-21 07:34:34 -07:00
parent 31a2a96810
commit 7afa8a9cdb
2 changed files with 11 additions and 0 deletions

View File

@ -0,0 +1,6 @@
function foobar(const i : int) : int is
const j : int = 3 ;
const k : int = 4 ;
function toto(const l : int) : int is
block { skip } with i + j + k + l;
block { skip } with toto(42)

View File

@ -69,6 +69,11 @@ let closure () : unit result =
let%bind program = type_file "./contracts/closure.ligo" in let%bind program = type_file "./contracts/closure.ligo" in
let%bind program_1 = type_file "./contracts/closure-1.ligo" in let%bind program_1 = type_file "./contracts/closure-1.ligo" in
let%bind program_2 = type_file "./contracts/closure-2.ligo" in let%bind program_2 = type_file "./contracts/closure-2.ligo" in
let%bind program_3 = type_file "./contracts/closure-3.ligo" in
let%bind _ =
let make_expect = fun n -> (49 + n) in
expect_eq_n_int program_3 "foobar" make_expect
in
let%bind _ = let%bind _ =
let make_expect = fun n -> (45 + n) in let make_expect = fun n -> (45 + n) in
expect_eq_n_int program_2 "foobar" make_expect expect_eq_n_int program_2 "foobar" make_expect