add tests for sum type names limit length

This commit is contained in:
Lesenechal Remi 2020-02-21 17:08:10 +01:00 committed by Pierre-Emmanuel Wulfman
parent 5a15feadc1
commit 503d8f771e
2 changed files with 31 additions and 0 deletions

View File

@ -1139,6 +1139,19 @@ let%expect_test _ =
storage (pair (map %one key_hash nat) (big_map %two key_hash bool)) ;
code { DUP ; CDR ; NIL operation ; PAIR ; DIP { DROP } } } |}]
let%expect_test _ =
run_ligo_bad [ "compile-contract" ; bad_contract "long_sum_type_names.ligo" ; "main" ] ;
[%expect {|
ligo: Too long constructor 'Incrementttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt': names length is limited to 32 (tezos limitation)
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' |}]
let%expect_test _ =
run_ligo_good [ "dry-run" ; contract "super-counter.mligo" ; "main" ; "test_param" ; "test_storage" ] ;
[%expect {|

View File

@ -0,0 +1,18 @@
type action is
| Incrementttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt of int
// | Increment of int
| Decrement of int
function add (const a : int ; const b : int) : int is a + b
function subtract (const a : int ; const b : int) : int is a - b
function main (const p : action ; const s : int) : (list(operation) * int) is
((nil : list(operation)),
case p of
| Incrementttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt (n) -> add (s, n)
// | Increment(n) -> add (s, n)
| Decrement (n) -> subtract (s, n)
end)
// incrementttttttttttttttttttttttt