Add ProgramTest::add_builtin_program()

This permits the unit testing of builtin programs in the ProgramTest environment
This commit is contained in:
Michael Vines 2021-09-20 21:32:21 -07:00 committed by mergify[bot]
parent 34f5020457
commit 830ca369f1
1 changed files with 14 additions and 0 deletions

View File

@ -715,6 +715,20 @@ impl ProgramTest {
}
}
/// Add a builtin program to the test environment.
///
/// Note that builtin programs are responsible for their own `stable_log` output.
pub fn add_builtin_program(
&mut self,
program_name: &str,
program_id: Pubkey,
process_instruction: ProcessInstructionWithContext,
) {
info!("\"{}\" builtin program", program_name);
self.builtins
.push(Builtin::new(program_name, program_id, process_instruction));
}
fn setup_bank(
&self,
) -> (