diff options
| author | Chris Denton <chris@chrisdenton.dev> | 2023-02-19 09:48:50 +0000 |
|---|---|---|
| committer | Chris Denton <chris@chrisdenton.dev> | 2023-02-21 18:33:19 +0000 |
| commit | 9b18b4440a8d8b052ef454dba9fdb95be99485e7 (patch) | |
| tree | ba15c08243893d0a772c3b9823d4d72b1db32aca /library/std/tests/env.rs | |
| parent | f7a132f4280cb8b01ba78126acc0cbea91951634 (diff) | |
| download | rust-9b18b4440a8d8b052ef454dba9fdb95be99485e7.tar.gz rust-9b18b4440a8d8b052ef454dba9fdb95be99485e7.zip | |
Make `create_dir_all_bare` an std integration test
Moving `create_dir_all` out of `ui-fulldeps` is complicated by the fact it sets the current directory. This means it can't be a unit test. Instead, move it to its own integration test.
Diffstat (limited to 'library/std/tests/env.rs')
| -rw-r--r-- | library/std/tests/env.rs | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/library/std/tests/env.rs b/library/std/tests/env.rs index aae2c49d898..96b4f372b8b 100644 --- a/library/std/tests/env.rs +++ b/library/std/tests/env.rs @@ -3,18 +3,8 @@ use std::ffi::{OsStr, OsString}; use rand::distributions::{Alphanumeric, DistString}; -/// Copied from `std::test_helpers::test_rng`, since these tests rely on the -/// seed not being the same for every RNG invocation too. -#[track_caller] -pub(crate) fn test_rng() -> rand_xorshift::XorShiftRng { - use core::hash::{BuildHasher, Hash, Hasher}; - let mut hasher = std::collections::hash_map::RandomState::new().build_hasher(); - core::panic::Location::caller().hash(&mut hasher); - let hc64 = hasher.finish(); - let seed_vec = hc64.to_le_bytes().into_iter().chain(0u8..8).collect::<Vec<u8>>(); - let seed: [u8; 16] = seed_vec.as_slice().try_into().unwrap(); - rand::SeedableRng::from_seed(seed) -} +mod common; +use common::test_rng; #[track_caller] fn make_rand_name() -> OsString { |
