From 3cb72f8ec2bbe4de36a57ac67dc4e99928f627f7 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Wulfman Date: Thu, 9 Apr 2020 16:24:55 +0200 Subject: [PATCH] add test --- src/bin/expect_tests/contract_tests.ml | 4 ++++ src/test/contracts/sequence.mligo | 8 ++++++++ src/test/integration_tests.ml | 5 +++++ 3 files changed, 17 insertions(+) create mode 100644 src/test/contracts/sequence.mligo diff --git a/src/bin/expect_tests/contract_tests.ml b/src/bin/expect_tests/contract_tests.ml index b285f2aac..e49fd5ed5 100644 --- a/src/bin/expect_tests/contract_tests.ml +++ b/src/bin/expect_tests/contract_tests.ml @@ -972,6 +972,10 @@ let%expect_test _ = PAIR ; DIP { DROP } } } |}] +let%expect_test _ = + run_ligo_good [ "print-ast-typed" ; contract "sequence.mligo" ; ]; + [%expect {| const y = lambda (_) return let x = +1 in let _ = let x = +2 in UNIT() in let _ = let x = +23 in UNIT() in let _ = let x = +42 in UNIT() in x |}] + let%expect_test _ = run_ligo_bad [ "compile-contract" ; contract "bad_type_operator.ligo" ; "main" ] ; [%expect {| diff --git a/src/test/contracts/sequence.mligo b/src/test/contracts/sequence.mligo new file mode 100644 index 000000000..0b37048c0 --- /dev/null +++ b/src/test/contracts/sequence.mligo @@ -0,0 +1,8 @@ +let y (_ : unit) : nat = + let x : nat = 1n in + begin + (let x : nat = 2n in unit) ; + (let x : nat = 23n in unit) ; + (let x : nat = 42n in unit) ; + x + end diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index aadfc7954..740071375 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -1192,6 +1192,10 @@ let condition_religo () : unit result = ] in ok () +let sequence_mligo () : unit result = + let%bind program = mtype_file "./contracts/sequence.mligo" in + expect_eq program "y" (e_unit ()) (e_nat 1) + let eq_bool_common program = let%bind _ = bind_map_list (fun ( a , b , expected ) -> @@ -2390,6 +2394,7 @@ let main = test_suite "Integration (End to End)" [ test "condition (ligo)" condition ; test "condition (mligo)" condition_mligo ; test "condition (religo)" condition_religo ; + test "sequence (mligo" sequence_mligo ; test "eq bool (ligo)" eq_bool ; test "eq bool (mligo)" eq_bool_mligo ; test "eq bool (religo)" eq_bool_religo ;