mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-01 05:31:01 +08:00
Pull an allocation out of the string escape test inner loop
This commit is contained in:
parent
98d88e06ff
commit
c1e1efd747
|
@ -183,10 +183,11 @@ fn test_convert() {
|
|||
|
||||
let seed: u128 = random::<u128>();
|
||||
let mut rng = Pcg64Mcg::new(seed);
|
||||
let mut origin = Vec::new();
|
||||
|
||||
for _ in 0..ESCAPE_TEST_COUNT {
|
||||
let length = rng.gen_range(0..=(2 * ESCAPE_TEST_LENGTH));
|
||||
let mut origin: Vec<u8> = vec![0; length];
|
||||
let length: usize = rng.gen_range(0..=(2 * ESCAPE_TEST_LENGTH));
|
||||
origin.resize(length, 0);
|
||||
rng.fill_bytes(&mut origin);
|
||||
|
||||
let w = str2wcstring(&origin[..]);
|
||||
|
|
Loading…
Reference in New Issue
Block a user