Merge branch 'feature/fix-evaluate-value' into 'dev'

fix evaluate-value and added tests

See merge request ligolang/ligo!356
This commit is contained in:
Rémi Lesenechal 2020-01-23 13:59:20 +00:00
commit c73c563461
3 changed files with 22 additions and 1 deletions

View File

@ -374,7 +374,7 @@ let evaluate_value =
let%bind compiled = Compile.Of_mini_c.aggregate_and_compile_expression mini_c exp in
let%bind options = Run.make_dry_run_options {predecessor_timestamp ; amount ; sender ; source } in
let%bind michelson_output = Run.run_no_failwith ~options compiled.expr compiled.expr_ty in
let%bind simplified_output = Uncompile.uncompile_typed_program_entry_function_result typed_prg entry_point michelson_output in
let%bind simplified_output = Uncompile.uncompile_typed_program_entry_expression_result typed_prg entry_point michelson_output in
ok @@ Format.asprintf "%a\n" Ast_simplified.PP.expression simplified_output
in
let term =

View File

@ -0,0 +1,10 @@
open Cli_expect
let%expect_test _ =
run_ligo_good [ "evaluate-value" ; "../../test/contracts/evaluation_tests.ligo" ; "a" ] ;
[%expect {|
{foo = +0 , bar = "bar"} |} ];
run_ligo_good [ "evaluate-value" ; "../../test/contracts/evaluation_tests.ligo" ; "b" ] ;
[%expect {|
2 |} ]

View File

@ -0,0 +1,11 @@
type myrec is record
foo : nat;
bar : string;
end;
const a : myrec = record
foo = 0n;
bar = "bar";
end;
const b : int = 2 ;