Skip to content

Commit

Permalink
tests: Add a compilation test for using data as an instruction para…
Browse files Browse the repository at this point in the history
…meter name
  • Loading branch information
acheroncrypto committed Feb 26, 2025
1 parent d970318 commit 343baf1
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/declare-program/idls/external.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,31 @@
],
"args": []
},
{
"name": "test_compilation_data_as_parameter_name",
"discriminator": [
225,
145,
68,
92,
146,
206,
248,
206
],
"accounts": [
{
"name": "signer",
"signer": true
}
],
"args": [
{
"name": "data",
"type": "bytes"
}
]
},
{
"name": "test_compilation_defined_type_param",
"discriminator": [
Expand Down
10 changes: 10 additions & 0 deletions tests/declare-program/programs/external/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(unused_variables)]

use anchor_lang::prelude::*;

declare_id!("Externa111111111111111111111111111111111111");
Expand Down Expand Up @@ -46,6 +48,14 @@ pub mod external {
Ok(true)
}

// Compilation test for whether `data` can be used as an instruction parameter name
pub fn test_compilation_data_as_parameter_name(
_ctx: Context<TestCompilation>,
data: Vec<u8>,
) -> Result<()> {
Ok(())
}

// Compilation test for an instruction with no accounts
pub fn test_compilation_no_accounts(_ctx: Context<TestCompilationNoAccounts>) -> Result<()> {
Ok(())
Expand Down

0 comments on commit 343baf1

Please sign in to comment.