From f47d32de2ebfc93f996b5358a69d0191664e0e75 Mon Sep 17 00:00:00 2001 From: Galfour Date: Tue, 7 May 2019 14:59:12 +0000 Subject: [PATCH] fix dispatch error --- src/ligo/main/contract.ml | 5 +---- src/ligo/test/bin_tests.ml | 13 +++++++++++++ src/ligo/test/integration_tests.ml | 16 ++++++++-------- src/ligo/test/test.ml | 1 + 4 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 src/ligo/test/bin_tests.ml diff --git a/src/ligo/main/contract.ml b/src/ligo/main/contract.ml index 18db9cc61..c9c1b3814 100644 --- a/src/ligo/main/contract.ml +++ b/src/ligo/main/contract.ml @@ -72,12 +72,9 @@ let compile_contract_file : string -> string -> string result = fun source entry let%bind typed = trace (simple_error "typing") @@ Typer.type_program simplified in - let%bind main_typed = - trace (simple_error "getting typed main") @@ - Ast_typed.program_to_main typed entry_point in let%bind mini_c = trace (simple_error "transpiling") @@ - Transpiler.translate_main main_typed in + Transpiler.translate_entry typed entry_point in let%bind michelson = trace (simple_error "compiling") @@ Compiler.translate_contract mini_c in diff --git a/src/ligo/test/bin_tests.ml b/src/ligo/test/bin_tests.ml new file mode 100644 index 000000000..bb97f75cc --- /dev/null +++ b/src/ligo/test/bin_tests.ml @@ -0,0 +1,13 @@ +open Trace +open Ligo +open Test_helpers + +let compile_contract_basic () : unit result = + let%bind _ = + Contract.compile_contract_file "./contracts/dispatch-counter.ligo" "main" + in + ok () + +let main = "Bin", [ + test "compile contract basic" compile_contract_basic ; +] diff --git a/src/ligo/test/integration_tests.ml b/src/ligo/test/integration_tests.ml index ed6440a70..424a8ddc8 100644 --- a/src/ligo/test/integration_tests.ml +++ b/src/ligo/test/integration_tests.ml @@ -70,14 +70,14 @@ let higher_order () : unit result = let shared_function () : unit result = let%bind program = type_file "./contracts/function-shared.ligo" in - (* let%bind () = - * let make_expect = fun n -> (n + 1) in - * expect_eq_n_int program "inc" make_expect - * in - * let%bind () = - * let make_expect = fun n -> (n + 2) in - * expect_eq_n_int program "double_inc" make_expect - * in *) + let%bind () = + let make_expect = fun n -> (n + 1) in + expect_eq_n_int program "inc" make_expect + in + let%bind () = + let make_expect = fun n -> (n + 2) in + expect_eq_n_int program "double_inc" make_expect + in let%bind () = let make_expect = fun n -> (2 * n + 3) in expect_eq program "foo" (e_a_int 0) (e_a_int @@ make_expect 0) diff --git a/src/ligo/test/test.ml b/src/ligo/test/test.ml index 2cb1ec87d..c4b9cd3f4 100644 --- a/src/ligo/test/test.ml +++ b/src/ligo/test/test.ml @@ -10,5 +10,6 @@ let () = Typer_tests.main ; Heap_tests.main ; Coase_tests.main ; + Bin_tests.main ; ] ; ()