From 63822e0430fda40d2132c59dbd74adb457d5980f Mon Sep 17 00:00:00 2001 From: galfour Date: Mon, 18 Nov 2019 18:44:15 +0100 Subject: [PATCH] test anon function --- src/test/contracts/function-anon.ligo | 1 + src/test/integration_tests.ml | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 src/test/contracts/function-anon.ligo diff --git a/src/test/contracts/function-anon.ligo b/src/test/contracts/function-anon.ligo new file mode 100644 index 000000000..2474ae73d --- /dev/null +++ b/src/test/contracts/function-anon.ligo @@ -0,0 +1 @@ +const x : int = (function (const i : int) : int is i + 1)(41) diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index 4352d9d0b..2dc606861 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -52,6 +52,13 @@ let complex_function () : unit result = let make_expect = fun n -> (3 * n + 2) in expect_eq_n_int program "main" make_expect +let anon_function () : unit result = + let%bind program = type_file "./contracts/function-anon.ligo" in + let%bind () = + expect_eq_evaluate program "x" (e_int 42) + in + ok () + let application () : unit result = let%bind program = type_file "./contracts/application.ligo" in let%bind () = @@ -1196,6 +1203,7 @@ let main = test_suite "Integration (End to End)" [ test "assign" assign ; test "declaration local" declaration_local ; test "complex function" complex_function ; + test "anon function" anon_function ; test "various applications" application ; test "closure" closure ; test "shared function" shared_function ;