Fix logging of seed in randomized test

This commit is contained in:
Max Brunsfeld 2021-11-19 12:16:43 -08:00
parent 1fe0420f0f
commit 2f9b7ac465

View file

@ -21,18 +21,18 @@ lazy_static! {
static ref TRIAL_FILTER: Option<usize> = env::var("TREE_SITTER_TEST_TRIAL_FILTER")
.map(|s| usize::from_str_radix(&s, 10).unwrap())
.ok();
pub static ref SEED: usize = env::var("TREE_SITTER_TEST_SEED")
.map(|s| {
let seed = usize::from_str_radix(&s, 10).unwrap();
eprintln!("\n\nRandom seed: {}\n", *SEED);
seed
})
.unwrap_or(
time::SystemTime::now()
.duration_since(time::UNIX_EPOCH)
.unwrap()
.as_secs() as usize,
);
pub static ref SEED: usize = {
let seed = env::var("TREE_SITTER_TEST_SEED")
.map(|s| usize::from_str_radix(&s, 10).unwrap())
.unwrap_or(
time::SystemTime::now()
.duration_since(time::UNIX_EPOCH)
.unwrap()
.as_secs() as usize,
);
eprintln!("\n\nRandom seed: {}\n", seed);
seed
};
}
#[test]