From 38c99eca53e6b36df3e5f3e42a4ae201914bd4f2 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Tue, 18 Feb 2020 12:31:19 +0100 Subject: [PATCH] carthage: add tests for comparable pairs --- src/bin/expect_tests/typer_error_tests.ml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/bin/expect_tests/typer_error_tests.ml b/src/bin/expect_tests/typer_error_tests.ml index 041fb2e93..4aa7b95e8 100644 --- a/src/bin/expect_tests/typer_error_tests.ml +++ b/src/bin/expect_tests/typer_error_tests.ml @@ -114,4 +114,25 @@ 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' |}] ; + * Check the changelog by running 'ligo changelog' |}] + +(* + This test is here to ensure compatibility with comparable pairs introduced in carthage + note that only "comb pairs" are allowed to be compared (would be beter if any pair would be comparable ?) +*) +let%expect_test _ = + run_ligo_good [ "interpret" ; "Set.literal [ (1,(2,3)) ; (2,(3,4)) ]" ; "--syntax=cameligo" ] ; + [%expect {| + set[( 2 , ( 3 , 4 ) ) , ( 1 , ( 2 , 3 ) )] |}]; + + run_ligo_bad [ "interpret" ; "Set.literal [ (1,2,3) ; (2,3,4) ]" ; "--syntax=cameligo" ] ; + [%expect {| + ligo: not a comparable type: pair (use (a,(b,c)) instead of (a,b,c)) + + 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' |}]; \ No newline at end of file