From a19e2ceb3bd6e8770c2e3df01cf27d23d7b24c42 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Wulfman Date: Tue, 3 Mar 2020 14:39:00 +0100 Subject: [PATCH] adding negative test --- src/bin/expect_tests/typer_error_tests.ml | 15 ++++++++++++++- .../negative/error_function_annotation.mligo | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/test/contracts/negative/error_function_annotation.mligo diff --git a/src/bin/expect_tests/typer_error_tests.ml b/src/bin/expect_tests/typer_error_tests.ml index 4aa7b95e8..32eb559d7 100644 --- a/src/bin/expect_tests/typer_error_tests.ml +++ b/src/bin/expect_tests/typer_error_tests.ml @@ -1,6 +1,19 @@ open Cli_expect let%expect_test _ = + run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_function_annotation.mligo"; "main"]; + [%expect {| + ligo: in file "", line 0, characters 0-0. different type constructors: Expected these two constant type constructors to be the same, but they're different {"a":"unit","b":"int"} + + + If you're not sure how to fix this error, you can + do one of the following: + + * Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ + * Ask a question on our Discord: https://discord.gg/9rhYaEt + * Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new + * Check the changelog by running 'ligo changelog' |}]; + run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_type.ligo" ; "main" ] ; [%expect {| ligo: in file "error_type.ligo", line 3, characters 18-28. Adding modulo with wrong types: Expected arguments with one of the following combinations of types: add(nat , nat) or add(int , int) or add(mutez , mutez) or add(nat , int) or add(int , nat) or add(timestamp , int) or add(int , timestamp) but got this combination instead: add(int , string) @@ -135,4 +148,4 @@ let%expect_test _ = * Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ * Ask a question on our Discord: https://discord.gg/9rhYaEt * Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new - * Check the changelog by running 'ligo changelog' |}]; \ No newline at end of file + * Check the changelog by running 'ligo changelog' |}]; diff --git a/src/test/contracts/negative/error_function_annotation.mligo b/src/test/contracts/negative/error_function_annotation.mligo new file mode 100644 index 000000000..3360a7b1a --- /dev/null +++ b/src/test/contracts/negative/error_function_annotation.mligo @@ -0,0 +1 @@ +let main (a:int) : unit = a