@@ -19,27 +19,6 @@ use spl_token::{error::TokenError, instruction::initialize_mint, state::Mint};
19
19
20
20
type InstructionPack < ' a > = ( Instruction , Vec < & ' a SolanaAccount > ) ;
21
21
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
-
43
22
fn do_process_instructions (
44
23
instructions : & [ InstructionPack ] ,
45
24
checks : & [ Check ] ,
@@ -96,18 +75,22 @@ fn test_initialize_mint() {
96
75
let rent_sysvar = rent_sysvar ( ) ;
97
76
98
77
// 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
+ ) ] ,
102
83
& [ Check :: err ( TokenError :: NotRentExempt . into ( ) ) ] ,
103
84
) ;
104
85
105
86
mint_account. lamports = mint_minimum_balance ( ) ;
106
87
107
88
// 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
+ ) ] ,
111
94
& [ Check :: success ( ) ] ,
112
95
) ;
113
96
@@ -127,9 +110,11 @@ fn test_initialize_mint() {
127
110
) ;
128
111
129
112
// 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
+ ) ] ,
133
118
& [
134
119
// Account successfully re-initialized.
135
120
Check :: success ( ) ,
0 commit comments