Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
d0cd committed Nov 12, 2022
1 parent 25a15aa commit 8048d27
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 22 deletions.
5 changes: 2 additions & 3 deletions tests/compiler/finalize/closure_with_finalize_fail.leo
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion tests/compiler/finalize/decrement.leo
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion tests/compiler/finalize/decrement_incorrect_type.leo
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion tests/compiler/finalize/empty_finalize_fail.leo
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand Down
12 changes: 10 additions & 2 deletions tests/compiler/finalize/finalize.leo
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions tests/compiler/finalize/finalize_incorrect_modes_fail.leo
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ 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 {
increment(account, receiver, amount);
}

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 {
Expand Down
2 changes: 1 addition & 1 deletion tests/compiler/finalize/finalize_incorrect_return_fail.leo
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tests/compiler/finalize/finalize_missing_return_fail.leo
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tests/compiler/finalize/finalize_name_mismatch_fail.leo
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion tests/compiler/finalize/increment.leo
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion tests/compiler/finalize/increment_incorrect_type.leo
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion tests/compiler/finalize/read_write_mapping_fail.leo
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions tests/compiler/function/self.leo
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 5 additions & 3 deletions tests/parser/finalize/finalize_statement.leo
Original file line number Diff line number Diff line change
Expand Up @@ -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);
2 changes: 2 additions & 0 deletions tests/parser/finalize/finalize_statement_fail.leo
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ async async finalize(foo);
finalize;

asyn finalize(foo);

return then fin;

0 comments on commit 8048d27

Please sign in to comment.