Skip to content

Commit

Permalink
Move test-only fn into tests module
Browse files Browse the repository at this point in the history
  • Loading branch information
CriesofCarrots committed Jul 3, 2024
1 parent d07f07e commit b4007bc
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions runtime/src/bank/recent_blockhashes_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ use solana_sdk::sysvar::recent_blockhashes::{
IntoIterSorted, IterItem, RecentBlockhashes, MAX_ENTRIES,
};
use {
solana_sdk::{
account::{
create_account_shared_data_with_fields, to_account, AccountSharedData,
InheritableAccountFields, DUMMY_INHERITABLE_ACCOUNT_FIELDS,
},
clock::INITIAL_RENT_EPOCH,
solana_sdk::account::{
create_account_shared_data_with_fields, to_account, AccountSharedData,
InheritableAccountFields,
},
std::{collections::BinaryHeap, iter::FromIterator},
};
Expand Down Expand Up @@ -46,31 +43,26 @@ where
account
}

#[deprecated(
since = "1.9.0",
note = "Please do not use, will no longer be available in the future"
)]
#[allow(deprecated)]
pub fn create_account_with_data_for_test<'a, I>(recent_blockhash_iter: I) -> AccountSharedData
where
I: IntoIterator<Item = IterItem<'a>>,
{
create_account_with_data_and_fields(recent_blockhash_iter, DUMMY_INHERITABLE_ACCOUNT_FIELDS)
}

#[cfg(test)]
mod tests {
#![allow(deprecated)]
use {
super::*,
rand::{seq::SliceRandom, thread_rng},
solana_sdk::{
account::from_account,
account::{from_account, DUMMY_INHERITABLE_ACCOUNT_FIELDS},
hash::{Hash, HASH_BYTES},
sysvar::recent_blockhashes::Entry,
},
};

fn create_account_with_data_for_test<'a, I>(recent_blockhash_iter: I) -> AccountSharedData
where
I: IntoIterator<Item = IterItem<'a>>,
{
create_account_with_data_and_fields(recent_blockhash_iter, DUMMY_INHERITABLE_ACCOUNT_FIELDS)
}

#[test]
fn test_create_account_empty() {
let account = create_account_with_data_for_test(vec![]);
Expand Down

0 comments on commit b4007bc

Please sign in to comment.