Add test for patterns guards

This commit is contained in:
Gaith Hallak 2021-09-02 12:52:34 +03:00
parent 4bfae33945
commit 74e8064a1b
2 changed files with 16 additions and 0 deletions

View File

@ -202,6 +202,7 @@ compilable_contracts() ->
"child_contract_init_bug", "child_contract_init_bug",
"using_namespace", "using_namespace",
"assign_patterns", "assign_patterns",
"patterns_guards",
"test" % Custom general-purpose test file. Keep it last on the list. "test" % Custom general-purpose test file. Keep it last on the list.
]. ].

View File

@ -0,0 +1,15 @@
include "List.aes"
contract C =
type state = int
entrypoint init() = f([1, 2, 3, 4])
function
f(x::[]) = 1
f(x::y::[]) = 2
f(x::y::z) = switch(z)
[] => 4
a::[] | a > 10 => 5
b | List.length(b) > 5 => 6
c => 7