2024-01-01 14:58:21 -05:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2023-01-12 20:59:13 -05:00
|
|
|
|
|
|
|
use test_util as util;
|
|
|
|
|
|
|
|
// Make sure that snapshot flags don't affect runtime.
|
|
|
|
#[test]
|
|
|
|
fn eval_randomness() {
|
|
|
|
let mut numbers = Vec::with_capacity(10);
|
|
|
|
for _ in 0..10 {
|
|
|
|
let output = util::deno_cmd()
|
|
|
|
.arg("eval")
|
|
|
|
.arg("-p")
|
|
|
|
.arg("Math.random()")
|
2023-11-17 10:05:42 -05:00
|
|
|
.stdout_piped()
|
2023-01-12 20:59:13 -05:00
|
|
|
.spawn()
|
|
|
|
.unwrap()
|
|
|
|
.wait_with_output()
|
|
|
|
.unwrap();
|
|
|
|
assert!(output.status.success());
|
|
|
|
let stdout_str = util::strip_ansi_codes(
|
|
|
|
std::str::from_utf8(&output.stdout).unwrap().trim(),
|
|
|
|
);
|
|
|
|
numbers.push(stdout_str.to_string());
|
|
|
|
}
|
|
|
|
numbers.dedup();
|
|
|
|
assert!(numbers.len() > 1);
|
|
|
|
}
|