@@ -19,27 +19,6 @@ use spl_token::{error::TokenError, instruction::initialize_mint, state::Mint};
1919
2020type InstructionPack < ' a > = ( Instruction , Vec < & ' a SolanaAccount > ) ;
2121
22- fn do_process_instruction (
23- instruction : Instruction ,
24- accounts : Vec < & SolanaAccount > ,
25- checks : & [ Check ] ,
26- ) -> InstructionResult {
27- let accounts = instruction
28- . accounts
29- . iter ( )
30- . zip ( accounts)
31- . map ( |( account_meta, account) | {
32- (
33- account_meta. pubkey ,
34- AccountSharedData :: from ( account. clone ( ) ) ,
35- )
36- } )
37- . collect :: < Vec < _ > > ( ) ;
38-
39- let mollusk = Mollusk :: new ( & spl_token:: id ( ) , "spl_token" ) ;
40- mollusk. process_and_validate_instruction ( & instruction, accounts. as_slice ( ) , checks)
41- }
42-
4322fn do_process_instructions (
4423 instructions : & [ InstructionPack ] ,
4524 checks : & [ Check ] ,
@@ -96,18 +75,22 @@ fn test_initialize_mint() {
9675 let rent_sysvar = rent_sysvar ( ) ;
9776
9877 // mint is not rent exempt
99- do_process_instruction (
100- initialize_mint ( & program_id, & mint_key, & owner_key, None , 2 ) . unwrap ( ) ,
101- vec ! [ & mint_account, & rent_sysvar] ,
78+ do_process_instructions (
79+ & [ (
80+ initialize_mint ( & program_id, & mint_key, & owner_key, None , 2 ) . unwrap ( ) ,
81+ vec ! [ & mint_account, & rent_sysvar] ,
82+ ) ] ,
10283 & [ Check :: err ( TokenError :: NotRentExempt . into ( ) ) ] ,
10384 ) ;
10485
10586 mint_account. lamports = mint_minimum_balance ( ) ;
10687
10788 // create new mint
108- do_process_instruction (
109- initialize_mint ( & program_id, & mint_key, & owner_key, None , 2 ) . unwrap ( ) ,
110- vec ! [ & mint_account, & rent_sysvar] ,
89+ do_process_instructions (
90+ & [ (
91+ initialize_mint ( & program_id, & mint_key, & owner_key, None , 2 ) . unwrap ( ) ,
92+ vec ! [ & mint_account, & rent_sysvar] ,
93+ ) ] ,
11194 & [ Check :: success ( ) ] ,
11295 ) ;
11396
@@ -127,9 +110,11 @@ fn test_initialize_mint() {
127110 ) ;
128111
129112 // create another mint that can freeze
130- do_process_instruction (
131- initialize_mint ( & program_id, & mint2_key, & owner_key, Some ( & owner_key) , 2 ) . unwrap ( ) ,
132- vec ! [ & mint2_account, & rent_sysvar] ,
113+ do_process_instructions (
114+ & [ (
115+ initialize_mint ( & program_id, & mint2_key, & owner_key, Some ( & owner_key) , 2 ) . unwrap ( ) ,
116+ vec ! [ & mint2_account, & rent_sysvar] ,
117+ ) ] ,
133118 & [
134119 // Account successfully re-initialized.
135120 Check :: success ( ) ,
0 commit comments