From 743098ecbddd2e2a99978eb8945cea22879987cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Fri, 7 Jun 2019 01:17:33 +0200 Subject: [PATCH] added test calling a function with ligo --- src/contracts/lambda.ligo | 6 ++++++ src/contracts/parser-bad-reported-term.ligo | 6 ++++++ src/test/integration_tests.ml | 7 +++++++ 3 files changed, 19 insertions(+) create mode 100644 src/contracts/lambda.ligo create mode 100644 src/contracts/parser-bad-reported-term.ligo diff --git a/src/contracts/lambda.ligo b/src/contracts/lambda.ligo new file mode 100644 index 000000000..cc426e83d --- /dev/null +++ b/src/contracts/lambda.ligo @@ -0,0 +1,6 @@ +function f (const x : unit) : unit is + begin skip end with unit + +function main (const p : unit ; const s : unit) : unit is + var y : unit := f(unit) ; + begin skip end with y diff --git a/src/contracts/parser-bad-reported-term.ligo b/src/contracts/parser-bad-reported-term.ligo new file mode 100644 index 000000000..05dc69e3e --- /dev/null +++ b/src/contracts/parser-bad-reported-term.ligo @@ -0,0 +1,6 @@ +function f (const x : unit) : unit is + begin skip end with unit + +function main (const p : unit ; const s : unit) : unit is + behin skip end with f unit +// the srcloc is correct but the reported term is "skip" instead of "behin". diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index ba9db500c..94616fef6 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -500,6 +500,12 @@ let lambda_mligo () : unit result = let make_expected = (e_unit ()) in expect_eq program "main" make_input make_expected +let lambda_ligo () : unit result = + let%bind program = type_file "./contracts/lambda.ligo" in + let make_input = e_pair (e_unit ()) (e_unit ()) in + let make_expected = (e_unit ()) in + expect_eq program "main" make_input make_expected + let lambda2_mligo () : unit result = let%bind program = mtype_file "./contracts/lambda2.mligo" in let make_input = e_pair (e_unit ()) (e_unit ()) in @@ -565,6 +571,7 @@ let main = test_suite "Integration (End to End)" [ (* test "failwith mligo" failwith_mligo ; *) (* test "guess string mligo" guess_string_mligo ; WIP? *) test "lambda mligo" lambda_mligo ; + test "lambda ligo" lambda_ligo ; (* test "lambda2 mligo" lambda2_mligo ; *) test "website1 ligo" website1_ligo ; test "website2 ligo" website2_ligo ;