test for typer error message: different keys

This commit is contained in:
Suzanne Dupéron 2019-12-17 18:16:25 +00:00
parent e919a1eba3
commit 2a11c6d180
2 changed files with 11 additions and 0 deletions

View File

@ -9,3 +9,7 @@ let%expect_test _ =
run_ligo_bad [ "compile-contract" ; "../../test/contracts/error_typer_3.mligo" ; "foo" ] ; run_ligo_bad [ "compile-contract" ; "../../test/contracts/error_typer_3.mligo" ; "foo" ] ;
[%expect {| ligo: in file "error_typer_3.mligo", line 3, characters 34-53. tuples have different sizes: Expected these two types to be the same, but they're different (both are tuples, but with a different number of arguments) {"a":"tuple[int , string , bool]","b":"tuple[int , string]"} |} ] ; [%expect {| ligo: in file "error_typer_3.mligo", line 3, characters 34-53. tuples have different sizes: Expected these two types to be the same, but they're different (both are tuples, but with a different number of arguments) {"a":"tuple[int , string , bool]","b":"tuple[int , string]"} |} ] ;
run_ligo_bad [ "compile-contract" ; "../../test/contracts/error_typer_4.mligo" ; "foo" ] ;
[%expect {| ligo: in file "error_typer_4.mligo", line 4, characters 17-56. different keys in record: {"key_a":"d","key_b":"c"} |} ] ;

View File

@ -0,0 +1,7 @@
type toto = { a : int ; b : string ; c : bool }
type tata = { a : int ; d : string ; c : bool }
let foo : tata = ({a = 1 ; b = "foo" ; c = true} : toto)
let main (p:int) (storage : int) =
(([] : operation list) , p + foo.a)