Skip to content

Commit

Permalink
test: use BumpVec instead of Vec in test_vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
bluurryy committed Nov 3, 2024
1 parent 6f36d6c commit 07a86af
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/tests/from_std/bump_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{
panic, str,
};

use crate::{bump_format, Bump, BumpString, BumpVec};
use crate::{bump_format, bump_vec, Bump, BumpString, BumpVec};

#[test]
fn test_from_utf8() {
Expand Down Expand Up @@ -447,15 +447,17 @@ fn test_simple_types() {
assert_eq!(bump_format!(in bump, "{}", BumpString::from_str_in("hi", &bump)), "hi");
}

// TODO: bump_vec!
#[test]
fn test_vectors() {
let bump: Bump = Bump::new();
let x: Vec<i32> = vec![];
let x: BumpVec<i32> = bump_vec![in bump];
assert_eq!(bump_format!(in bump, "{x:?}"), "[]");
assert_eq!(bump_format!(in bump, "{:?}", vec![1]), "[1]");
assert_eq!(bump_format!(in bump, "{:?}", vec![1, 2, 3]), "[1, 2, 3]");
assert!(bump_format!(in bump, "{:?}", vec![vec![], vec![1], vec![1, 1]]) == "[[], [1], [1, 1]]");
assert_eq!(bump_format!(in bump, "{:?}", bump_vec![in bump; 1]), "[1]");
assert_eq!(bump_format!(in bump, "{:?}", bump_vec![in bump; 1, 2, 3]), "[1, 2, 3]");
assert!(
bump_format!(in bump, "{:?}", bump_vec![in bump; bump_vec![in bump], bump_vec![in bump; 1], bump_vec![in bump; 1, 1]])
== "[[], [1], [1, 1]]"
);
}

#[test]
Expand Down

0 comments on commit 07a86af

Please sign in to comment.