Add test for patterns guards
This commit is contained in:
parent
4bfae33945
commit
74e8064a1b
@ -202,6 +202,7 @@ compilable_contracts() ->
|
||||
"child_contract_init_bug",
|
||||
"using_namespace",
|
||||
"assign_patterns",
|
||||
"patterns_guards",
|
||||
"test" % Custom general-purpose test file. Keep it last on the list.
|
||||
].
|
||||
|
||||
|
15
test/contracts/patterns_guards.aes
Normal file
15
test/contracts/patterns_guards.aes
Normal 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
|
Loading…
x
Reference in New Issue
Block a user