1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -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:
HasanAlrimawi 2024-09-03 18:14:19 +03:00 committed by GitHub
parent b8ed6f8221
commit 1d04c84c8f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 53 additions and 66 deletions

View file

@ -1,24 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
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.
#[test]
@ -43,48 +25,3 @@ fn eval_randomness() {
numbers.dedup();
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",
});

View file

@ -0,0 +1,4 @@
{
"args": "eval --quiet import('http://localhost:4545/subdir/type_error.ts').then(console.log);",
"output": "main.out"
}

View file

@ -0,0 +1,4 @@
{
"args": "eval --quiet import('./check_local_by_default2.ts').then(console.log);",
"output": "main.out"
}

View file

@ -0,0 +1,4 @@
{
"args": "eval import('./mod4.js').then(console.log)",
"output": "main.out"
}

View file

@ -0,0 +1 @@
export const isMod4 = true;

View file

@ -0,0 +1,4 @@
{
"args": "eval --env-file=env_file console.log(Deno.env.get(\"ANOTHER_FOO\"));",
"output": "main.out"
}

View file

@ -0,0 +1,4 @@
FOO=BAR
ANOTHER_FOO=ANOTHER_${FOO}
MULTILINE="First Line
Second Line"

View file

@ -0,0 +1 @@
ANOTHER_BAR

View file

@ -0,0 +1,4 @@
{
"args": "eval --env-file=missing console.log(Deno.env.get(\"ANOTHER_FOO\"));",
"output": "main.out"
}

View file

@ -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"
}

View file

@ -0,0 +1,4 @@
FOO=valid
ANOTHER_FOO=c:\path
MULTILINE="First Line
Second Line"

View file

@ -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

View file

@ -0,0 +1,4 @@
{
"args": "eval console.log(\"hello\")",
"output": "main.out"
}

View file

@ -0,0 +1 @@
hello

View file

@ -0,0 +1,4 @@
{
"args": "eval -p 1+2",
"output": "main.out"
}

View file

@ -0,0 +1 @@
3

View file

@ -0,0 +1,4 @@
{
"args": "eval --quiet --ext=ts console.log((123)as(number))",
"output": "main.out"
}

View file

@ -0,0 +1 @@
123

View file

@ -0,0 +1,4 @@
{
"args": "eval --v8-flags=--expose-gc console.log(typeof(gc))",
"output": "main.out"
}

View file

@ -0,0 +1 @@
function

View file

@ -202,7 +202,7 @@ async function ensureNoNewITests() {
"compile_tests.rs": 0,
"coverage_tests.rs": 0,
"doc_tests.rs": 15,
"eval_tests.rs": 9,
"eval_tests.rs": 0,
"flags_tests.rs": 0,
"fmt_tests.rs": 17,
"info_tests.rs": 18,