mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
chore: deprecate eval itests (#25382)
This PR serves as a part of #22907 . --------- Signed-off-by: David Sherret <dsherret@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
This commit is contained in:
parent
b8ed6f8221
commit
1d04c84c8f
26 changed files with 53 additions and 66 deletions
|
@ -1,24 +1,6 @@
|
||||||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
use test_util as util;
|
use test_util as util;
|
||||||
use test_util::itest;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn eval_p() {
|
|
||||||
let output = util::deno_cmd()
|
|
||||||
.arg("eval")
|
|
||||||
.arg("-p")
|
|
||||||
.arg("1+2")
|
|
||||||
.stdout_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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure that snapshot flags don't affect runtime.
|
// Make sure that snapshot flags don't affect runtime.
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -43,48 +25,3 @@ fn eval_randomness() {
|
||||||
numbers.dedup();
|
numbers.dedup();
|
||||||
assert!(numbers.len() > 1);
|
assert!(numbers.len() > 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
itest!(eval_basic {
|
|
||||||
args: "eval console.log(\"hello\")",
|
|
||||||
output_str: Some("hello\n"),
|
|
||||||
});
|
|
||||||
|
|
||||||
// Ugly parentheses due to whitespace delimiting problem.
|
|
||||||
itest!(eval_ts {
|
|
||||||
args: "eval --quiet --ext=ts console.log((123)as(number))", // 'as' is a TS keyword only
|
|
||||||
output_str: Some("123\n"),
|
|
||||||
});
|
|
||||||
|
|
||||||
itest!(dyn_import_eval {
|
|
||||||
args: "eval import('./subdir/mod4.js').then(console.log)",
|
|
||||||
output: "eval/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: "run/v8_flags.js.out",
|
|
||||||
});
|
|
||||||
|
|
||||||
itest!(check_local_by_default {
|
|
||||||
args: "eval --quiet import('http://localhost:4545/subdir/type_error.ts').then(console.log);",
|
|
||||||
output: "eval/check_local_by_default.out",
|
|
||||||
http_server: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
itest!(check_local_by_default2 {
|
|
||||||
args: "eval --quiet import('./eval/check_local_by_default2.ts').then(console.log);",
|
|
||||||
output: "eval/check_local_by_default2.out",
|
|
||||||
http_server: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
itest!(env_file {
|
|
||||||
args: "eval --env=env console.log(Deno.env.get(\"ANOTHER_FOO\"))",
|
|
||||||
output_str: Some("ANOTHER_BAR\n"),
|
|
||||||
});
|
|
||||||
|
|
||||||
itest!(env_file_missing {
|
|
||||||
args: "eval --env=missing console.log(Deno.env.get(\"ANOTHER_FOO\"))",
|
|
||||||
output: "eval/env_file_missing.out",
|
|
||||||
});
|
|
||||||
|
|
4
tests/specs/eval/check_local/__test__.jsonc
Normal file
4
tests/specs/eval/check_local/__test__.jsonc
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"args": "eval --quiet import('http://localhost:4545/subdir/type_error.ts').then(console.log);",
|
||||||
|
"output": "main.out"
|
||||||
|
}
|
4
tests/specs/eval/check_local_by_default2/__test__.jsonc
Normal file
4
tests/specs/eval/check_local_by_default2/__test__.jsonc
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"args": "eval --quiet import('./check_local_by_default2.ts').then(console.log);",
|
||||||
|
"output": "main.out"
|
||||||
|
}
|
4
tests/specs/eval/dyn_import_eval/__test__.jsonc
Normal file
4
tests/specs/eval/dyn_import_eval/__test__.jsonc
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"args": "eval import('./mod4.js').then(console.log)",
|
||||||
|
"output": "main.out"
|
||||||
|
}
|
1
tests/specs/eval/dyn_import_eval/mod4.js
Normal file
1
tests/specs/eval/dyn_import_eval/mod4.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export const isMod4 = true;
|
4
tests/specs/eval/env_file/__test__.jsonc
Normal file
4
tests/specs/eval/env_file/__test__.jsonc
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"args": "eval --env-file=env_file console.log(Deno.env.get(\"ANOTHER_FOO\"));",
|
||||||
|
"output": "main.out"
|
||||||
|
}
|
4
tests/specs/eval/env_file/env_file
Normal file
4
tests/specs/eval/env_file/env_file
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
FOO=BAR
|
||||||
|
ANOTHER_FOO=ANOTHER_${FOO}
|
||||||
|
MULTILINE="First Line
|
||||||
|
Second Line"
|
1
tests/specs/eval/env_file/main.out
Normal file
1
tests/specs/eval/env_file/main.out
Normal file
|
@ -0,0 +1 @@
|
||||||
|
ANOTHER_BAR
|
4
tests/specs/eval/env_file_missing/__test__.jsonc
Normal file
4
tests/specs/eval/env_file_missing/__test__.jsonc
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"args": "eval --env-file=missing console.log(Deno.env.get(\"ANOTHER_FOO\"));",
|
||||||
|
"output": "main.out"
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"args": "eval --env=../../../testdata/env_unparsable console.log(Deno.env.get(\"Another_FOO\"))",
|
"args": "eval --env-file=env_unparsable console.log(Deno.env.get(\"ANOTHER_FOO\"));",
|
||||||
"output": "main.out"
|
"output": "main.out"
|
||||||
}
|
}
|
||||||
|
|
4
tests/specs/eval/env_unparsable_file/env_unparsable
Normal file
4
tests/specs/eval/env_unparsable_file/env_unparsable
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
FOO=valid
|
||||||
|
ANOTHER_FOO=c:\path
|
||||||
|
MULTILINE="First Line
|
||||||
|
Second Line"
|
|
@ -1,2 +1,2 @@
|
||||||
Warning Parsing failed within the specified environment file: ../../../testdata/env_unparsable at index: 3 of the value: c:\path
|
Warning Parsing failed within the specified environment file: env_unparsable at index: 3 of the value: c:\path
|
||||||
undefined
|
undefined
|
||||||
|
|
4
tests/specs/eval/eval_basic/__test__.jsonc
Normal file
4
tests/specs/eval/eval_basic/__test__.jsonc
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"args": "eval console.log(\"hello\")",
|
||||||
|
"output": "main.out"
|
||||||
|
}
|
1
tests/specs/eval/eval_basic/main.out
Normal file
1
tests/specs/eval/eval_basic/main.out
Normal file
|
@ -0,0 +1 @@
|
||||||
|
hello
|
4
tests/specs/eval/eval_p/__test__.jsonc
Normal file
4
tests/specs/eval/eval_p/__test__.jsonc
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"args": "eval -p 1+2",
|
||||||
|
"output": "main.out"
|
||||||
|
}
|
1
tests/specs/eval/eval_p/main.out
Normal file
1
tests/specs/eval/eval_p/main.out
Normal file
|
@ -0,0 +1 @@
|
||||||
|
3
|
4
tests/specs/eval/eval_ts/__test__.jsonc
Normal file
4
tests/specs/eval/eval_ts/__test__.jsonc
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"args": "eval --quiet --ext=ts console.log((123)as(number))",
|
||||||
|
"output": "main.out"
|
||||||
|
}
|
1
tests/specs/eval/eval_ts/main.out
Normal file
1
tests/specs/eval/eval_ts/main.out
Normal file
|
@ -0,0 +1 @@
|
||||||
|
123
|
4
tests/specs/eval/v8_flags_eval/__test__.jsonc
Normal file
4
tests/specs/eval/v8_flags_eval/__test__.jsonc
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"args": "eval --v8-flags=--expose-gc console.log(typeof(gc))",
|
||||||
|
"output": "main.out"
|
||||||
|
}
|
1
tests/specs/eval/v8_flags_eval/main.out
Normal file
1
tests/specs/eval/v8_flags_eval/main.out
Normal file
|
@ -0,0 +1 @@
|
||||||
|
function
|
|
@ -202,7 +202,7 @@ async function ensureNoNewITests() {
|
||||||
"compile_tests.rs": 0,
|
"compile_tests.rs": 0,
|
||||||
"coverage_tests.rs": 0,
|
"coverage_tests.rs": 0,
|
||||||
"doc_tests.rs": 15,
|
"doc_tests.rs": 15,
|
||||||
"eval_tests.rs": 9,
|
"eval_tests.rs": 0,
|
||||||
"flags_tests.rs": 0,
|
"flags_tests.rs": 0,
|
||||||
"fmt_tests.rs": 17,
|
"fmt_tests.rs": 17,
|
||||||
"info_tests.rs": 18,
|
"info_tests.rs": 18,
|
||||||
|
|
Loading…
Reference in a new issue