Skip to content

Commit

Permalink
Update more panic format change affected tests...
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoqun committed Aug 31, 2023
1 parent 4ff19a2 commit bf73572
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
14 changes: 6 additions & 8 deletions accounts-db/src/account_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ pub(crate) mod tests {
}

#[test]
#[should_panic(expected = "assertion failed: self.no_shrink_in_progress()")]
#[should_panic(expected = "self.no_shrink_in_progress()")]
fn test_get_slot_storage_entry_fail() {
let storage = AccountStorage::default();
storage
Expand All @@ -362,7 +362,7 @@ pub(crate) mod tests {
}

#[test]
#[should_panic(expected = "assertion failed: self.no_shrink_in_progress()")]
#[should_panic(expected = "self.no_shrink_in_progress()")]
fn test_all_slots_fail() {
let storage = AccountStorage::default();
storage
Expand All @@ -372,7 +372,7 @@ pub(crate) mod tests {
}

#[test]
#[should_panic(expected = "assertion failed: self.no_shrink_in_progress()")]
#[should_panic(expected = "self.no_shrink_in_progress()")]
fn test_initialize_fail() {
let mut storage = AccountStorage::default();
storage
Expand All @@ -382,9 +382,7 @@ pub(crate) mod tests {
}

#[test]
#[should_panic(
expected = "assertion failed: shrink_can_be_active || self.shrink_in_progress_map.is_empty()"
)]
#[should_panic(expected = "shrink_can_be_active || self.shrink_in_progress_map.is_empty()")]
fn test_remove_fail() {
let storage = AccountStorage::default();
storage
Expand All @@ -394,7 +392,7 @@ pub(crate) mod tests {
}

#[test]
#[should_panic(expected = "assertion failed: self.no_shrink_in_progress()")]
#[should_panic(expected = "self.no_shrink_in_progress()")]
fn test_iter_fail() {
let storage = AccountStorage::default();
storage
Expand All @@ -404,7 +402,7 @@ pub(crate) mod tests {
}

#[test]
#[should_panic(expected = "assertion failed: self.no_shrink_in_progress()")]
#[should_panic(expected = "self.no_shrink_in_progress()")]
fn test_insert_fail() {
let storage = AccountStorage::default();
let sample = storage.get_test_storage();
Expand Down
2 changes: 1 addition & 1 deletion accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17764,7 +17764,7 @@ pub mod tests {
}

#[test]
#[should_panic(expected = "assertion failed: self.storage.remove")]
#[should_panic(expected = "self.storage.remove")]
fn test_handle_dropped_roots_for_ancient_assert() {
solana_logger::setup();
let common_store_path = Path::new("");
Expand Down
2 changes: 1 addition & 1 deletion accounts-db/src/ancient_append_vecs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ pub mod tests {

#[test]
#[should_panic(
expected = "assertion failed: accounts_to_combine.target_slots_sorted.len() >= packed_contents.len()"
expected = "accounts_to_combine.target_slots_sorted.len() >= packed_contents.len()"
)]
fn test_write_packed_storages_too_few_slots() {
let (db, storages, slots, _infos) = get_sample_storages(1, None);
Expand Down
2 changes: 1 addition & 1 deletion accounts-db/src/append_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ pub mod tests {
static_assertions::assert_eq_align!(u64, StoredMeta, AccountMeta);

#[test]
#[should_panic(expected = "assertion failed: accounts.has_hash_and_write_version()")]
#[should_panic(expected = "accounts.has_hash_and_write_version()")]
fn test_storable_accounts_with_hashes_and_write_versions_new() {
let account = AccountSharedData::default();
// for (Slot, &'a [(&'a Pubkey, &'a T)], IncludeSlotInHash)
Expand Down
4 changes: 2 additions & 2 deletions accounts-db/src/rolling_bit_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,13 +477,13 @@ pub mod tests {
}

#[test]
#[should_panic(expected = "assertion failed: max_width.is_power_of_two()")]
#[should_panic(expected = "max_width.is_power_of_two()")]
fn test_bitfield_power_2() {
let _ = RollingBitField::new(3);
}

#[test]
#[should_panic(expected = "assertion failed: max_width > 0")]
#[should_panic(expected = "max_width > 0")]
fn test_bitfield_0() {
let _ = RollingBitField::new(0);
}
Expand Down
4 changes: 3 additions & 1 deletion bucket_map/src/bucket_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,9 @@ mod test {
}

#[test]
#[should_panic(expected = "assertion failed: `(left == right)`")]
// rust 1.73+ (our as-of-writing nightly version) changed panic message. we're stuck with this
// short common substring until the monorepo is fully 1.73+ including stable.
#[should_panic(expected = "left == right")]
fn test_header_size() {
_ = BucketStorage::<BucketBadHeader>::new_with_capacity(
Arc::default(),
Expand Down
2 changes: 1 addition & 1 deletion entry/src/poh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ mod tests {
}

#[test]
#[should_panic(expected = "assertion failed: hashes_per_tick > 1")]
#[should_panic(expected = "hashes_per_tick > 1")]
fn test_target_poh_time_hashes_per_tick() {
let zero = Hash::default();
let poh = Poh::new(zero, Some(0));
Expand Down
4 changes: 2 additions & 2 deletions runtime/src/bank/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3585,7 +3585,7 @@ fn test_bank_hash_internal_state_verify() {
}

#[test]
#[should_panic(expected = "assertion failed: self.is_frozen()")]
#[should_panic(expected = "self.is_frozen()")]
fn test_verify_hash_unfrozen() {
let bank = create_simple_test_bank(2_000);
assert!(bank.verify_hash());
Expand Down Expand Up @@ -12459,7 +12459,7 @@ fn test_distribute_partitioned_epoch_rewards() {
}

#[test]
#[should_panic(expected = "assertion failed: self.epoch_schedule.get_slots_in_epoch")]
#[should_panic(expected = "self.epoch_schedule.get_slots_in_epoch")]
fn test_distribute_partitioned_epoch_rewards_too_many_partitions() {
let (genesis_config, _mint_keypair) = create_genesis_config(1_000_000 * LAMPORTS_PER_SOL);
let mut bank = Bank::new_for_tests(&genesis_config);
Expand Down
2 changes: 1 addition & 1 deletion sdk/program/src/epoch_rewards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ mod tests {

#[test]
#[should_panic(
expected = "assertion failed: self.distributed_rewards.saturating_add(amount) <= self.total_rewards"
expected = "self.distributed_rewards.saturating_add(amount) <= self.total_rewards"
)]
fn test_epoch_rewards_distribute_panic() {
let mut epoch_rewards = EpochRewards::new(100, 0, 64);
Expand Down

0 comments on commit bf73572

Please sign in to comment.