diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2021-06-27 13:27:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-27 13:27:36 -0400 |
commit | 098a7c8886a5be80f2acb4ed81365498a228ca0a (patch) | |
tree | 05d4ed8b1c7985228d109326eac1a6add8fe0af1 /cli/tests/integration/eval_tests.rs | |
parent | 5bf7da91f178067c62d07f0220c99ba27791d206 (diff) |
chore: split up integration_tests.rs into separate files (#11131)
Diffstat (limited to 'cli/tests/integration/eval_tests.rs')
-rw-r--r-- | cli/tests/integration/eval_tests.rs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/cli/tests/integration/eval_tests.rs b/cli/tests/integration/eval_tests.rs new file mode 100644 index 000000000..40fa26158 --- /dev/null +++ b/cli/tests/integration/eval_tests.rs @@ -0,0 +1,44 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. + +use crate::itest; +use test_util as util; + +#[test] +fn eval_p() { + let output = util::deno_cmd() + .arg("eval") + .arg("-p") + .arg("1+2") + .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()); + assert_eq!("3", stdout_str); +} + +itest!(_029_eval { + args: "eval console.log(\"hello\")", + output: "029_eval.out", +}); + +// Ugly parentheses due to whitespace delimiting problem. +itest!(_030_eval_ts { + args: "eval --quiet --ext=ts console.log((123)as(number))", // 'as' is a TS keyword only + output: "030_eval_ts.out", +}); + +itest!(_041_dyn_import_eval { + args: "eval import('./subdir/mod4.js').then(console.log)", + output: "041_dyn_import_eval.out", +}); + +// Cannot write the expression to evaluate as "console.log(typeof gc)" +// because itest! splits args on whitespace. +itest!(v8_flags_eval { + args: "eval --v8-flags=--expose-gc console.log(typeof(gc))", + output: "v8_flags.js.out", +}); |