Skip to content

Commit

Permalink
test: add contract call test
Browse files Browse the repository at this point in the history
  • Loading branch information
matteojug committed Sep 16, 2024
1 parent 948d6d2 commit 8c902d5
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion clar2wasm/src/words/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ mod tests {
use clarity::vm::errors::{CheckErrors, Error};
use clarity::vm::Value;

use crate::tools::{crosscheck, crosscheck_expect_failure, crosscheck_with_epoch, evaluate};
use crate::tools::{
crosscheck, crosscheck_expect_failure, crosscheck_multi_contract, crosscheck_with_epoch,
evaluate,
};

#[test]
fn top_level_define_first() {
Expand Down Expand Up @@ -361,4 +364,25 @@ mod tests {
))),
);
}

#[test]
fn reuse_arg_name_contrac_call() {
let first_contract_name = "callee".into();
let first_snippet = "
(define-public (foo (a int) (a int) (b int) (b int)) (ok 1))
";

let second_contract_name = "caller".into();
let second_snippet = format!(r#"(contract-call? .{first_contract_name} foo 1 2 3 4)"#);

crosscheck_multi_contract(
&[
(first_contract_name, first_snippet),
(second_contract_name, &second_snippet),
],
Err(Error::Unchecked(CheckErrors::NameAlreadyUsed(
"a".to_string(),
))),
);
}
}

0 comments on commit 8c902d5

Please sign in to comment.