From 74e8064a1bd10e34b79abc702574a5973468d0b8 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Thu, 2 Sep 2021 12:52:34 +0300 Subject: [PATCH] Add test for patterns guards --- test/aeso_compiler_tests.erl | 1 + test/contracts/patterns_guards.aes | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 test/contracts/patterns_guards.aes diff --git a/test/aeso_compiler_tests.erl b/test/aeso_compiler_tests.erl index 1af71da..af88614 100644 --- a/test/aeso_compiler_tests.erl +++ b/test/aeso_compiler_tests.erl @@ -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. ]. diff --git a/test/contracts/patterns_guards.aes b/test/contracts/patterns_guards.aes new file mode 100644 index 0000000..6c6db60 --- /dev/null +++ b/test/contracts/patterns_guards.aes @@ -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 \ No newline at end of file