Added test case from GitLab issue
This commit is contained in:
parent
da5b9c1612
commit
673fb67c1c
@ -18,6 +18,9 @@ let%expect_test _ =
|
||||
run_ligo_good [ "measure-contract" ; contract "vote.mligo" ; "main" ] ;
|
||||
[%expect {| 582 bytes |}] ;
|
||||
|
||||
run_ligo_good [ "measure-contract" ; contract "issue-184-combs.mligo" ; "main2" ] ;
|
||||
[%expect {| 369 bytes |}] ;
|
||||
|
||||
run_ligo_good [ "compile-parameter" ; contract "coase.ligo" ; "main" ; "Buy_single (record card_to_buy = 1n end)" ] ;
|
||||
[%expect {| (Left (Left 1)) |}] ;
|
||||
|
||||
|
34
src/test/contracts/issue-184-combs.mligo
Normal file
34
src/test/contracts/issue-184-combs.mligo
Normal file
@ -0,0 +1,34 @@
|
||||
(* Test case from https://gitlab.com/ligolang/ligo/-/issues/184 *)
|
||||
|
||||
type foo = {
|
||||
bar : string;
|
||||
baz : nat;
|
||||
}
|
||||
|
||||
type foo_michelson = foo michelson_pair_right_comb
|
||||
|
||||
type union1 =
|
||||
| Choice1 of foo
|
||||
| Choice2 of foo
|
||||
|
||||
type union1_aux =
|
||||
| Option1 of foo_michelson
|
||||
| Option2 of foo_michelson
|
||||
|
||||
type union1_michelson = union1_aux michelson_or_right_comb
|
||||
|
||||
let union1_from_michelson (m : union1_michelson) : union1 =
|
||||
let aux : union1_aux = Layout.convert_from_right_comb m in
|
||||
match aux with
|
||||
| Option1 fm ->
|
||||
let f : foo = Layout.convert_from_right_comb fm in
|
||||
Choice1 f
|
||||
| Option2 fm ->
|
||||
let f : foo = Layout.convert_from_right_comb fm in
|
||||
Choice2 f
|
||||
|
||||
let main2 (ums, us : (union1_michelson list) * (union1 list)) =
|
||||
let new_us = List.map union1_from_michelson ums in
|
||||
([] : operation list), new_us
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user