From 8048d2754b38b8c580625894c2bb179229df87b9 Mon Sep 17 00:00:00 2001 From: d0cd Date: Sun, 16 Oct 2022 12:04:54 -0700 Subject: [PATCH] Update tests --- .../compiler/finalize/closure_with_finalize_fail.leo | 5 ++--- tests/compiler/finalize/decrement.leo | 2 +- tests/compiler/finalize/decrement_incorrect_type.leo | 2 +- tests/compiler/finalize/empty_finalize_fail.leo | 2 +- tests/compiler/finalize/finalize.leo | 12 ++++++++++-- .../finalize/finalize_incorrect_modes_fail.leo | 4 ++-- .../finalize/finalize_incorrect_return_fail.leo | 2 +- .../finalize/finalize_missing_return_fail.leo | 2 +- .../finalize/finalize_name_mismatch_fail.leo | 2 +- .../finalize_statement_incorrect_args_fail.leo | 2 +- tests/compiler/finalize/increment.leo | 2 +- tests/compiler/finalize/increment_incorrect_type.leo | 2 +- tests/compiler/finalize/read_write_mapping_fail.leo | 2 +- tests/compiler/function/self.leo | 3 +-- tests/parser/finalize/finalize_statement.leo | 8 +++++--- tests/parser/finalize/finalize_statement_fail.leo | 2 ++ 16 files changed, 32 insertions(+), 22 deletions(-) diff --git a/tests/compiler/finalize/closure_with_finalize_fail.leo b/tests/compiler/finalize/closure_with_finalize_fail.leo index bf97f6e3eb..3268fd978f 100644 --- a/tests/compiler/finalize/closure_with_finalize_fail.leo +++ b/tests/compiler/finalize/closure_with_finalize_fail.leo @@ -5,8 +5,7 @@ expectation: Fail program test.aleo { function foo(a: u8, b: u8) -> u8 { - async finalize(a, b); - return a + b; + return a + b then finalize(a, b); } function bar(a: u8, b: u8) -> u8 { @@ -19,7 +18,7 @@ program test.aleo { function mint_public(receiver: address, amount: u64) { - async finalize(receiver, amount); + return then finalize(receiver, amount); } finalize mint_public(receiver: address, amount: u64) { diff --git a/tests/compiler/finalize/decrement.leo b/tests/compiler/finalize/decrement.leo index 3f091a3513..495deb95b9 100644 --- a/tests/compiler/finalize/decrement.leo +++ b/tests/compiler/finalize/decrement.leo @@ -7,7 +7,7 @@ program test.aleo { mapping amounts: address => u128; transition decrease_self(amount: u128) { - async finalize(self.caller, amount); + return then finalize(self.caller, amount); } finalize decrease_self(addr: address, amount: u128) { diff --git a/tests/compiler/finalize/decrement_incorrect_type.leo b/tests/compiler/finalize/decrement_incorrect_type.leo index cc9c2bf7b1..867071d057 100644 --- a/tests/compiler/finalize/decrement_incorrect_type.leo +++ b/tests/compiler/finalize/decrement_incorrect_type.leo @@ -14,7 +14,7 @@ program test.aleo { mapping tokens: address => Token; transition decrease_self(amount: u128) { - async finalize(self.caller, amount); + return then finalize(self.caller, amount); } finalize decrease_self(addr: address, amount: u128) { diff --git a/tests/compiler/finalize/empty_finalize_fail.leo b/tests/compiler/finalize/empty_finalize_fail.leo index 59b4e65869..ce1cfee9b9 100644 --- a/tests/compiler/finalize/empty_finalize_fail.leo +++ b/tests/compiler/finalize/empty_finalize_fail.leo @@ -6,7 +6,7 @@ expectation: Fail program test.aleo { transition mint_public(public receiver: address, public amount: u64) { - async finalize(receiver, amount); + return then finalize(receiver, amount); } finalize mint_public (public receiver: address, public amount: u64) {} diff --git a/tests/compiler/finalize/finalize.leo b/tests/compiler/finalize/finalize.leo index e491538b93..19e341a1df 100644 --- a/tests/compiler/finalize/finalize.leo +++ b/tests/compiler/finalize/finalize.leo @@ -8,15 +8,23 @@ program test.aleo { mapping values: u8 => u8; transition mint_public(public receiver: address, public amount: u64) { - async finalize(receiver, amount); + return then finalize(receiver, amount); } finalize mint_public (public receiver: address, public amount: u64) { increment(account, receiver, amount); } + transition public_adder(public a: u8, public b: u8) { + return then finalize(a, b); + } + + finalize public_adder(a: u8, b: u8) -> public u8 { + return a + b; + } + transition finalize_no_params() { - async finalize(); + return then finalize(); } finalize finalize_no_params() { diff --git a/tests/compiler/finalize/finalize_incorrect_modes_fail.leo b/tests/compiler/finalize/finalize_incorrect_modes_fail.leo index f5ca10d901..0b0f99a268 100644 --- a/tests/compiler/finalize/finalize_incorrect_modes_fail.leo +++ b/tests/compiler/finalize/finalize_incorrect_modes_fail.leo @@ -7,7 +7,7 @@ program test.aleo { mapping account: address => u64; transition mint_public(public receiver: address, public amount: u64) { - async finalize(receiver, amount); + return then finalize(receiver, amount); } finalize mint_public (public receiver: address, constant amount: u64) -> constant u64 { @@ -15,7 +15,7 @@ program test.aleo { } transition mint_public2(public receiver: address, public amount: u64) { - async finalize(receiver, amount); + return then finalize(receiver, amount); } finalize mint_public2(public receiver: address, amount: u64) -> u64 { diff --git a/tests/compiler/finalize/finalize_incorrect_return_fail.leo b/tests/compiler/finalize/finalize_incorrect_return_fail.leo index 02f618a111..e21e151eee 100644 --- a/tests/compiler/finalize/finalize_incorrect_return_fail.leo +++ b/tests/compiler/finalize/finalize_incorrect_return_fail.leo @@ -7,7 +7,7 @@ program test.aleo { mapping account: address => u64; transition mint_public(public receiver: address, public amount: u64) { - async finalize(receiver, amount); + return then finalize(receiver, amount); } finalize mint_public(public receiver: address, public amount: u64) -> u64 { diff --git a/tests/compiler/finalize/finalize_missing_return_fail.leo b/tests/compiler/finalize/finalize_missing_return_fail.leo index 1ca8068a83..e6fc604356 100644 --- a/tests/compiler/finalize/finalize_missing_return_fail.leo +++ b/tests/compiler/finalize/finalize_missing_return_fail.leo @@ -8,7 +8,7 @@ program test.aleo { mapping account: address => u64; transition mint_public(public receiver: address, public amount: u64) { - async finalize(receiver, amount); + return then finalize(receiver, amount); } finalize mint_public (public receiver: address, public amount: u64) -> u64 { diff --git a/tests/compiler/finalize/finalize_name_mismatch_fail.leo b/tests/compiler/finalize/finalize_name_mismatch_fail.leo index 84542fd8dd..5394caa07e 100644 --- a/tests/compiler/finalize/finalize_name_mismatch_fail.leo +++ b/tests/compiler/finalize/finalize_name_mismatch_fail.leo @@ -8,7 +8,7 @@ program test.aleo { mapping values: u8 => u8; transition mint_public(public receiver: address, public amount: u64) { - async finalize(receiver, amount); + return then finalize(receiver, amount); } finalize mint_private (public receiver: address, public amount: u64) { diff --git a/tests/compiler/finalize/finalize_statement_incorrect_args_fail.leo b/tests/compiler/finalize/finalize_statement_incorrect_args_fail.leo index 770c42fcf4..ef210a95eb 100644 --- a/tests/compiler/finalize/finalize_statement_incorrect_args_fail.leo +++ b/tests/compiler/finalize/finalize_statement_incorrect_args_fail.leo @@ -8,7 +8,7 @@ program test.aleo { mapping account: address => u64; transition mint_public(public receiver: address, public amount: u64) { - async finalize(receiver, amount, amount); + return then finalize(receiver, amount, amount); } finalize mint_public (public receiver: address, public amount: u64) { diff --git a/tests/compiler/finalize/increment.leo b/tests/compiler/finalize/increment.leo index 669bbfc653..5e014fdd86 100644 --- a/tests/compiler/finalize/increment.leo +++ b/tests/compiler/finalize/increment.leo @@ -7,7 +7,7 @@ program test.aleo { mapping amounts: address => u128; transition increase_self(amount: u128) { - async finalize(self.caller, amount); + return then finalize(self.caller, amount); } finalize increase_self(addr: address, amount: u128) { diff --git a/tests/compiler/finalize/increment_incorrect_type.leo b/tests/compiler/finalize/increment_incorrect_type.leo index 000df33403..f4e21d24a1 100644 --- a/tests/compiler/finalize/increment_incorrect_type.leo +++ b/tests/compiler/finalize/increment_incorrect_type.leo @@ -14,7 +14,7 @@ program test.aleo { mapping tokens: address => Token; transition increase_self(amount: u128) { - async finalize(self.caller, amount); + return then finalize(self.caller, amount); } finalize increase_self(addr: address, amount: u128) { diff --git a/tests/compiler/finalize/read_write_mapping_fail.leo b/tests/compiler/finalize/read_write_mapping_fail.leo index 3700d7e215..4031715d15 100644 --- a/tests/compiler/finalize/read_write_mapping_fail.leo +++ b/tests/compiler/finalize/read_write_mapping_fail.leo @@ -23,7 +23,7 @@ program test.aleo { } function write_in_finalize(public addr: address, public amount: u128) { - async finalize(addr, amount); + return then finalize(addr, amount); } finalize write_in_finalize(public: addr: address, public amount: u128) { diff --git a/tests/compiler/function/self.leo b/tests/compiler/function/self.leo index c1bec8adfd..f3b86979e8 100644 --- a/tests/compiler/function/self.leo +++ b/tests/compiler/function/self.leo @@ -5,8 +5,7 @@ expectation: Pass program test.aleo { transition matches(addr: address) -> bool { - async finalize(self.caller); - return self.caller == addr; + return self.caller == addr then finalize(self.caller); } finalize matches(addr: address) -> bool { return addr == self.caller; } diff --git a/tests/parser/finalize/finalize_statement.leo b/tests/parser/finalize/finalize_statement.leo index 16e2e579f0..b4a433954c 100644 --- a/tests/parser/finalize/finalize_statement.leo +++ b/tests/parser/finalize/finalize_statement.leo @@ -3,8 +3,10 @@ namespace: ParseStatement expectation: Pass */ -async finalize(); +return then finalize; -async finalize(foo); +return then finalize(); -async finalize(foo, bar); +return then finalize(foo); + +return then finalize(foo, bar); diff --git a/tests/parser/finalize/finalize_statement_fail.leo b/tests/parser/finalize/finalize_statement_fail.leo index 01c4511e1e..d91d9983ff 100644 --- a/tests/parser/finalize/finalize_statement_fail.leo +++ b/tests/parser/finalize/finalize_statement_fail.leo @@ -14,3 +14,5 @@ async async finalize(foo); finalize; asyn finalize(foo); + +return then fin;