From 2a11c6d180c3b241396e4ff0f2ae6dd34d978b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Tue, 17 Dec 2019 18:16:25 +0000 Subject: [PATCH] test for typer error message: different keys --- src/bin/expect_tests/typer_error_tests.ml | 4 ++++ src/test/contracts/error_typer_4.mligo | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 src/test/contracts/error_typer_4.mligo diff --git a/src/bin/expect_tests/typer_error_tests.ml b/src/bin/expect_tests/typer_error_tests.ml index 75cbe96a3..6c1dc3cb1 100644 --- a/src/bin/expect_tests/typer_error_tests.ml +++ b/src/bin/expect_tests/typer_error_tests.ml @@ -9,3 +9,7 @@ let%expect_test _ = 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]"} |} ] ; + + 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"} |} ] ; + diff --git a/src/test/contracts/error_typer_4.mligo b/src/test/contracts/error_typer_4.mligo new file mode 100644 index 000000000..a09820a8b --- /dev/null +++ b/src/test/contracts/error_typer_4.mligo @@ -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)