Skip to content

Commit

Permalink
Merge branch 'master' into aj/release-4.0.0-alpha.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ascjones committed Sep 21, 2022
2 parents 8841505 + b04f097 commit b1ae082
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/env/src/engine/off_chain/test_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,8 @@ pub fn assert_contract_termination<T, F>(
/// Prepend contract message call with value transfer. Used for tests in off-chain environment.
#[macro_export]
macro_rules! pay_with_call {
($contract:ident . $message:ident ( $($params:ty)? ) , $amount:expr) => {{
($contract:ident . $message:ident ( $( $params:expr ),* ) , $amount:expr) => {{
$crate::test::transfer_in::<Environment>($amount);
$contract.$message($($params:ty)?)
$contract.$message($ ($params) ,*)
}}
}
2 changes: 2 additions & 0 deletions crates/ink/tests/compile_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ fn ui_tests() {
t.compile_fail("tests/ui/trait_def/fail/*.rs");

t.pass("tests/ui/chain_extension/E-01-simple.rs");

t.pass("tests/ui/pay_with_call/pass/multiple_args.rs");
}
29 changes: 29 additions & 0 deletions crates/ink/tests/ui/pay_with_call/pass/multiple_args.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#[ink::contract]
mod contract {
#[ink(storage)]
pub struct Contract {}

impl Contract {
#[ink(constructor)]
pub fn new() -> Self {
Self {}
}

#[ink(message)]
pub fn message0(&self) {}

#[ink(message)]
pub fn message1(&self, _arg1: u8) {}

#[ink(message)]
pub fn message2(&self, _arg1: u8, _arg2: (u8, AccountId)) {}

fn check_compiles(&self) {
ink::env::pay_with_call!(self.message0(), 0);
ink::env::pay_with_call!(self.message1(0), 0);
ink::env::pay_with_call!(self.message2(0, (0, Self::env().account_id())), 0);
}
}
}

fn main() {}

0 comments on commit b1ae082

Please sign in to comment.