Skip to content

Commit 695ce95

Browse files
committed
simple account data provision in tests
1 parent 423127d commit 695ce95

2 files changed

Lines changed: 186 additions & 248 deletions

File tree

program/tests/helpers/context.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,18 @@ impl StakeTestContext {
5757
StakeAccountBuilder { lifecycle }
5858
}
5959

60-
/// Process an instruction
61-
pub fn process_with(
60+
/// Process an instruction with account data provided as a slice of (pubkey, data) pairs.
61+
/// Sysvars are auto-resolved - only provide data for accounts that need it.
62+
pub fn process<'b>(
6263
&self,
6364
instruction: Instruction,
64-
accounts: Vec<(Pubkey, AccountSharedData)>,
65-
) -> InstructionExecution {
66-
InstructionExecution::new(instruction, accounts, self)
65+
accounts: &[(&Pubkey, &AccountSharedData)],
66+
) -> InstructionExecution<'_, 'b> {
67+
let accounts_vec = accounts
68+
.iter()
69+
.map(|(pk, data)| (**pk, (*data).clone()))
70+
.collect();
71+
InstructionExecution::new(instruction, accounts_vec, self)
6772
}
6873

6974
/// Process an instruction with optional missing signer testing

0 commit comments

Comments
 (0)