diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2022-05-17 20:49:55 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-17 20:49:55 +0530 |
commit | 68bf43fca7990d4e623b66243c2840ca7f0c3628 (patch) | |
tree | b5b94663c0923281ce1c7e71bbeb06843d2f770a /cli/tests/integration/eval_tests.rs | |
parent | d76acfdc17e27b53fc53e6cd3051ff0acaefef42 (diff) |
feat(core): deterministic snapshots (#14037)
Diffstat (limited to 'cli/tests/integration/eval_tests.rs')
-rw-r--r-- | cli/tests/integration/eval_tests.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/cli/tests/integration/eval_tests.rs b/cli/tests/integration/eval_tests.rs index d7586e919..d7503ca80 100644 --- a/cli/tests/integration/eval_tests.rs +++ b/cli/tests/integration/eval_tests.rs @@ -20,6 +20,30 @@ fn eval_p() { assert_eq!("3", stdout_str); } +// 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()") + .stdout(std::process::Stdio::piped()) + .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); +} + itest!(_029_eval { args: "eval console.log(\"hello\")", output: "029_eval.out", |