fix evaluate-value and added tests
This commit is contained in:
parent
74c57776d8
commit
69d125b667
@ -374,7 +374,7 @@ let evaluate_value =
|
|||||||
let%bind compiled = Compile.Of_mini_c.aggregate_and_compile_expression mini_c exp in
|
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 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 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
|
ok @@ Format.asprintf "%a\n" Ast_simplified.PP.expression simplified_output
|
||||||
in
|
in
|
||||||
let term =
|
let term =
|
||||||
|
10
src/bin/expect_tests/eval_value_tests.ml
Normal file
10
src/bin/expect_tests/eval_value_tests.ml
Normal 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 |} ]
|
11
src/test/contracts/evaluation_tests.ligo
Normal file
11
src/test/contracts/evaluation_tests.ligo
Normal 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 ;
|
Loading…
Reference in New Issue
Block a user