From 7afa8a9cdb2760f552b398adf40441825510e40d Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Wed, 21 Aug 2019 07:34:34 -0700 Subject: [PATCH] Test closures more --- src/contracts/closure-3.ligo | 6 ++++++ src/test/integration_tests.ml | 5 +++++ 2 files changed, 11 insertions(+) create mode 100644 src/contracts/closure-3.ligo diff --git a/src/contracts/closure-3.ligo b/src/contracts/closure-3.ligo new file mode 100644 index 000000000..71fb67269 --- /dev/null +++ b/src/contracts/closure-3.ligo @@ -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) diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index 5a4cf635e..df6f11f5d 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -69,6 +69,11 @@ let closure () : unit result = let%bind program = type_file "./contracts/closure.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_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 make_expect = fun n -> (45 + n) in expect_eq_n_int program_2 "foobar" make_expect