diff --git a/Cargo.lock b/Cargo.lock index daaf89639b..09e8246fd8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -286,6 +286,7 @@ dependencies = [ "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", + "os_pipe 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -766,6 +767,18 @@ dependencies = [ "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "nix" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "nodrop" version = "0.1.13" @@ -788,6 +801,15 @@ dependencies = [ "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "os_pipe" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "owning_ref" version = "0.4.0" @@ -1995,9 +2017,11 @@ dependencies = [ "checksum miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" "checksum nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce" +"checksum nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3b2e0b4f3320ed72aaedb9a5ac838690a8047c7b275da22711fddff4f8a14229" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" "checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273" +"checksum os_pipe 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "81e8dfa4c69d7bde595e9a940fcf1d7f60966d3fce8a8c4cad67c60e35ea2a11" "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" "checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" "checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index a56fddeaf8..8869098636 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -62,3 +62,6 @@ fwdansi = "1.0.1" [target.'cfg(unix)'.dependencies] nix = "0.14.1" + +[dev-dependencies] +os_pipe = "0.8.2" diff --git a/cli/integration_tests.rs b/cli/integration_tests.rs new file mode 100644 index 0000000000..9bf0c43b69 --- /dev/null +++ b/cli/integration_tests.rs @@ -0,0 +1,643 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +use crate::ansi::strip_ansi_codes; +use os_pipe::pipe; +use std::env; +use std::io::Read; +use std::io::Write; +use std::path::PathBuf; +use std::process::Command; +use std::process::Stdio; + +macro_rules! itest( + ($name:ident {$( $key:ident: $value:expr,)*}) => { + #[test] + fn $name() { + (IntegrationTest { + $( + $key: $value, + )* + .. Default::default() + }).run() + } + } +); + +itest!(_001_hello { + args: "run --reload 001_hello.js", + output: "tests/001_hello.js.out", +}); + +itest!(_002_hello { + args: "run --reload 002_hello.ts", + output: "tests/002_hello.ts.out", +}); + +itest!(_003_relative_import { + args: "run --reload 003_relative_import.ts", + output: "tests/003_relative_import.ts.out", +}); + +itest!(_004_set_timeout { + args: "run --reload 004_set_timeout.ts", + output: "tests/004_set_timeout.ts.out", +}); + +itest!(_005_more_imports { + args: "run --reload 005_more_imports.ts", + output: "tests/005_more_imports.ts.out", +}); + +itest!(_006_url_imports { + args: "run --reload 006_url_imports.ts", + output: "tests/006_url_imports.ts.out", +}); + +itest!(_012_async { + args: "run --reload 012_async.ts", + output: "tests/012_async.ts.out", +}); + +itest!(_013_dynamic_import { + args: "013_dynamic_import.ts --reload --allow-read", + output: "tests/013_dynamic_import.ts.out", +}); + +itest!(_014_duplicate_import { + args: "014_duplicate_import.ts --reload --allow-read", + output: "tests/014_duplicate_import.ts.out", +}); + +itest!(_015_duplicate_parallel_import { + args: "015_duplicate_parallel_import.js --reload --allow-read", + output: "tests/015_duplicate_parallel_import.js.out", +}); + +itest!(_016_double_await { + args: "run --allow-read --reload 016_double_await.ts", + output: "tests/016_double_await.ts.out", +}); + +itest!(_017_import_redirect { + args: "run --reload 017_import_redirect.ts", + output: "tests/017_import_redirect.ts.out", +}); + +itest!(_018_async_catch { + args: "run --reload 018_async_catch.ts", + output: "tests/018_async_catch.ts.out", +}); + +itest!(_019_media_types { + args: "run --reload 019_media_types.ts", + output: "tests/019_media_types.ts.out", +}); + +itest!(_020_json_modules { + args: "run --reload 020_json_modules.ts", + output: "tests/020_json_modules.ts.out", +}); + +itest!(_021_mjs_modules { + args: "run --reload 021_mjs_modules.ts", + output: "tests/021_mjs_modules.ts.out", +}); + +itest!(_022_info_flag_script { + args: "info http://127.0.0.1:4545/tests/019_media_types.ts", + output: "tests/022_info_flag_script.out", +}); + +itest!(_023_no_ext_with_headers { + args: "run --reload 023_no_ext_with_headers", + output: "tests/023_no_ext_with_headers.out", +}); + +// FIXME(bartlomieju): this test should use remote file +// itest!(_024_import_no_ext_with_headers { +// args: "run --reload 024_import_no_ext_with_headers.ts", +// output: "tests/024_import_no_ext_with_headers.ts.out", +// }); + +itest!(_025_hrtime { + args: "run --allow-hrtime --reload 025_hrtime.ts", + output: "tests/025_hrtime.ts.out", +}); + +itest!(_025_reload_js_type_error { + args: "run --reload 025_reload_js_type_error.js", + output: "tests/025_reload_js_type_error.js.out", +}); + +itest!(_026_redirect_javascript { + args: "run --reload 026_redirect_javascript.js", + output: "tests/026_redirect_javascript.js.out", +}); + +itest!(_026_workers { + args: "run --reload 026_workers.ts", + output: "tests/026_workers.ts.out", +}); + +itest!(_027_redirect_typescript { + args: "run --reload 027_redirect_typescript.ts", + output: "tests/027_redirect_typescript.ts.out", +}); + +itest!(_028_args { + args: "run --reload 028_args.ts --arg1 val1 --arg2=val2 -- arg3 arg4", + output: "tests/028_args.ts.out", +}); + +itest!(_029_eval { + args: "eval console.log(\"hello\")", + output: "tests/029_eval.out", +}); + +itest!(_030_xeval { + args: "xeval console.log($.toUpperCase())", + input: Some("a\nb\n\nc"), + output: "tests/030_xeval.out", +}); + +itest!(_031_xeval_replvar { + args: "xeval -I val console.log(val.toUpperCase());", + input: Some("a\nb\n\nc"), + output: "tests/031_xeval_replvar.out", +}); + +itest!(_032_xeval_delim { + args: "xeval -d DELIM console.log($.toUpperCase());", + input: Some("aDELIMbDELIMDELIMc"), + output: "tests/032_xeval_delim.out", +}); + +itest!(_033_import_map { + args: + "run --reload --importmap=importmaps/import_map.json importmaps/test.ts", + output: "tests/033_import_map.out", +}); + +itest!(_034_onload { + args: "run --reload 034_onload/main.ts", + output: "tests/034_onload.out", +}); + +itest!(_035_no_fetch_flag { + args: "--reload --no-fetch http://127.0.0.1:4545/tests/019_media_types.ts", + output: "tests/035_no_fetch_flag.out", + exit_code: 1, + check_stderr: true, +}); + +itest!(_036_import_map_fetch { + args: + "fetch --reload --importmap=importmaps/import_map.json importmaps/test.ts", + output: "tests/036_import_map_fetch.out", +}); + +itest!(_037_current_thread { + args: "run --current-thread --reload 034_onload/main.ts", + output: "tests/034_onload.out", +}); + +itest!(_038_checkjs { + // checking if JS file is run through TS compiler + args: "run --reload --config 038_checkjs.tsconfig.json 038_checkjs.js", + check_stderr: true, + exit_code: 1, + output: "tests/038_checkjs.js.out", +}); + +itest!(_039_worker_deno_ns { + args: "run --reload 039_worker_deno_ns.ts", + output: "tests/039_worker_deno_ns.ts.out", +}); + +itest!(_040_worker_blob { + args: "run --reload 040_worker_blob.ts", + output: "tests/040_worker_blob.ts.out", +}); + +itest!(_041_dyn_import_eval { + args: "eval import('./subdir/mod4.js').then(console.log)", + output: "tests/041_dyn_import_eval.out", +}); + +itest!(_041_info_flag { + args: "info", + output: "tests/041_info_flag.out", +}); + +itest!(_042_dyn_import_evalcontext { + args: "run --allow-read --reload 042_dyn_import_evalcontext.ts", + output: "tests/042_dyn_import_evalcontext.ts.out", +}); + +itest!(async_error { + exit_code: 1, + args: "run --reload async_error.ts", + check_stderr: true, + output: "tests/async_error.ts.out", +}); + +itest!(circular1 { + args: "run --reload circular1.js", + output: "tests/circular1.js.out", +}); + +itest!(config { + args: "run --reload --config config.tsconfig.json config.ts", + check_stderr: true, + exit_code: 1, + output: "tests/config.ts.out", +}); + +itest!(error_001 { + args: "run --reload error_001.ts", + check_stderr: true, + exit_code: 1, + output: "tests/error_001.ts.out", +}); + +itest!(error_002 { + args: "run --reload error_002.ts", + check_stderr: true, + exit_code: 1, + output: "tests/error_002.ts.out", +}); + +itest!(error_003_typescript { + args: "run --reload error_003_typescript.ts", + check_stderr: true, + exit_code: 1, + output: "tests/error_003_typescript.ts.out", +}); + +// Supposing that we've already attempted to run error_003_typescript.ts +// we want to make sure that JS wasn't emitted. Running again without reload flag +// should result in the same output. +// https://github.com/denoland/deno/issues/2436 +itest!(error_003_typescript2 { + args: "run error_003_typescript.ts", + check_stderr: true, + exit_code: 1, + output: "tests/error_003_typescript.ts.out", +}); + +itest!(error_004_missing_module { + args: "run --reload error_004_missing_module.ts", + check_stderr: true, + exit_code: 1, + output: "tests/error_004_missing_module.ts.out", +}); + +itest!(error_005_missing_dynamic_import { + args: "run --reload error_005_missing_dynamic_import.ts", + check_stderr: true, + exit_code: 1, + output: "tests/error_005_missing_dynamic_import.ts.out", +}); + +itest!(error_006_import_ext_failure { + args: "run --reload error_006_import_ext_failure.ts", + check_stderr: true, + exit_code: 1, + output: "tests/error_006_import_ext_failure.ts.out", +}); + +itest!(error_007_any { + args: "run --reload error_007_any.ts", + check_stderr: true, + exit_code: 1, + output: "tests/error_007_any.ts.out", +}); + +itest!(error_008_checkjs { + args: "run --reload error_008_checkjs.js", + check_stderr: true, + exit_code: 1, + output: "tests/error_008_checkjs.js.out", +}); + +itest!(error_011_bad_module_specifier { + args: "run --reload error_011_bad_module_specifier.ts", + check_stderr: true, + exit_code: 1, + output: "tests/error_011_bad_module_specifier.ts.out", +}); + +itest!(error_012_bad_dynamic_import_specifier { + args: "run --reload error_012_bad_dynamic_import_specifier.ts", + check_stderr: true, + exit_code: 1, + output: "tests/error_012_bad_dynamic_import_specifier.ts.out", +}); + +itest!(error_013_missing_script { + args: "run --reload missing_file_name", + check_stderr: true, + exit_code: 1, + output: "tests/error_013_missing_script.out", +}); + +itest!(error_014_catch_dynamic_import_error { + args: "error_014_catch_dynamic_import_error.js --reload --allow-read", + output: "tests/error_014_catch_dynamic_import_error.js.out", +}); + +itest!(error_015_dynamic_import_permissions { + args: "--reload --no-prompt error_015_dynamic_import_permissions.js", + output: "tests/error_015_dynamic_import_permissions.out", + check_stderr: true, + exit_code: 1, +}); + +// We have an allow-net flag but not allow-read, it should still result in error. +itest!(error_016_dynamic_import_permissions2 { + args: + "--no-prompt --reload --allow-net error_016_dynamic_import_permissions2.js", + output: "tests/error_016_dynamic_import_permissions2.out", + check_stderr: true, + exit_code: 1, +}); + +itest!(error_stack { + args: "run --reload error_stack.ts", + check_stderr: true, + exit_code: 1, + output: "tests/error_stack.ts.out", +}); + +itest!(error_syntax { + args: "run --reload error_syntax.js", + check_stderr: true, + exit_code: 1, + output: "tests/error_syntax.js.out", +}); + +itest!(error_type_definitions { + args: "run --reload error_type_definitions.ts", + check_stderr: true, + exit_code: 1, + output: "tests/error_type_definitions.ts.out", +}); + +itest!(exit_error42 { + exit_code: 42, + args: "run --reload exit_error42.ts", + output: "tests/exit_error42.ts.out", +}); + +itest!(https_import { + args: "run --reload https_import.ts", + output: "tests/https_import.ts.out", +}); + +itest!(if_main { + args: "run --reload if_main.ts", + output: "tests/if_main.ts.out", +}); + +itest!(import_meta { + args: "run --reload import_meta.ts", + output: "tests/import_meta.ts.out", +}); + +itest!(seed_random { + args: "run --seed=100 seed_random.js", + output: "tests/seed_random.js.out", +}); + +itest!(type_definitions { + args: "run --reload type_definitions.ts", + output: "tests/type_definitions.ts.out", +}); + +itest!(types { + args: "types", + output: "tests/types.out", +}); + +itest!(unbuffered_stderr { + args: "run --reload unbuffered_stderr.ts", + check_stderr: true, + output: "tests/unbuffered_stderr.ts.out", +}); + +itest!(unbuffered_stdout { + args: "run --reload unbuffered_stdout.ts", + output: "tests/unbuffered_stdout.ts.out", +}); + +itest!(v8_flags { + args: "run --v8-flags=--expose-gc v8_flags.js", + output: "tests/v8_flags.js.out", +}); + +itest!(v8_help { + args: "--v8-options", + output: "tests/v8_help.out", +}); + +itest!(version { + args: "version", + output: "tests/version.out", +}); + +itest!(version_long_flag { + args: "--version", + output: "tests/version.out", +}); + +itest!(version_short_flag { + args: "-v", + output: "tests/version.out", +}); + +itest!(wasm { + args: "run wasm.ts", + output: "tests/wasm.ts.out", +}); + +itest!(wasm_async { + args: "wasm_async.js", + output: "tests/wasm_async.out", +}); + +/////////////////////////// + +#[derive(Debug, Default)] +struct IntegrationTest { + args: &'static str, + output: &'static str, + input: Option<&'static str>, + exit_code: i32, + check_stderr: bool, +} + +impl IntegrationTest { + pub fn run(&self) { + let args = self.args.split_whitespace(); + let root = PathBuf::from(concat!(env!("CARGO_MANIFEST_DIR"), "/..")); + let mut target = "debug"; + + if let Ok(build_mode) = env::var("DENO_BUILD_MODE") { + if build_mode == "release" { + target = "release"; + } + } + + let bin = root.join(format!("target/{}/deno", target)); + debug!("root path {}", root.display()); + debug!("bin path {}", bin.display()); + + let (mut reader, writer) = pipe().unwrap(); + let mut command = Command::new(bin); + command.args(args); + command.current_dir(root.join("tests")); + command.stdin(Stdio::piped()); + command.stderr(Stdio::null()); + + if self.check_stderr { + let writer_clone = writer.try_clone().unwrap(); + command.stderr(writer_clone); + } + + command.stdout(writer); + + let mut process = command.spawn().expect("failed to execute process"); + + if let Some(input) = self.input { + let mut p_stdin = process.stdin.take().unwrap(); + write!(p_stdin, "{}", input).unwrap(); + } + + // Very important when using pipes: This parent process is still + // holding its copies of the write ends, and we have to close them + // before we read, otherwise the read end will never report EOF. The + // Command object owns the writers now, and dropping it closes them. + drop(command); + + let mut actual = String::new(); + reader.read_to_string(&mut actual).unwrap(); + + let status = process.wait().expect("failed to finish process"); + let exit_code = status.code().unwrap(); + + actual = strip_ansi_codes(&actual).to_string(); + + if self.exit_code != exit_code { + println!("OUTPUT\n{}\nOUTPUT", actual); + panic!( + "bad exit code, expected: {:?}, actual: {:?}", + self.exit_code, exit_code + ); + } + + let output_path = root.join(self.output); + debug!("output path {}", output_path.display()); + let expected = + std::fs::read_to_string(output_path).expect("cannot read output"); + + if !wildcard_match(&expected, &actual) { + println!("OUTPUT\n{}\nOUTPUT", actual); + println!("EXPECTED\n{}\nEXPECTED", expected); + panic!("pattern match failed"); + } + } +} + +fn wildcard_match(pattern: &str, s: &str) -> bool { + pattern_match(pattern, s, "[WILDCARD]") +} + +fn pattern_match(pattern: &str, s: &str, wildcard: &str) -> bool { + // Normalize line endings + let s = s.replace("\r\n", "\n"); + let pattern = pattern.replace("\r\n", "\n"); + + if pattern == wildcard { + return true; + } + + let parts = pattern.split(wildcard).collect::>(); + if parts.len() == 1 { + return pattern == s; + } + + if !s.starts_with(parts[0]) { + return false; + } + + let mut t = s.split_at(parts[0].len()); + + for (i, part) in parts.iter().enumerate() { + if i == 0 { + continue; + } + dbg!(part, i); + if i == parts.len() - 1 && (*part == "" || *part == "\n") { + dbg!("exit 1 true", i); + return true; + } + if let Some(found) = t.1.find(*part) { + dbg!("found ", found); + t = t.1.split_at(found + part.len()); + } else { + dbg!("exit false ", i); + return false; + } + } + + dbg!("end ", t.1.len()); + t.1.is_empty() +} + +#[test] +fn test_wildcard_match() { + let fixtures = vec![ + ("foobarbaz", "foobarbaz", true), + ("[WILDCARD]", "foobarbaz", true), + ("foobar", "foobarbaz", false), + ("foo[WILDCARD]baz", "foobarbaz", true), + ("foo[WILDCARD]baz", "foobazbar", false), + ("foo[WILDCARD]baz[WILDCARD]qux", "foobarbazqatqux", true), + ("foo[WILDCARD]", "foobar", true), + ("foo[WILDCARD]baz[WILDCARD]", "foobarbazqat", true), + // check with different line endings + ("foo[WILDCARD]\nbaz[WILDCARD]\n", "foobar\nbazqat\n", true), + ( + "foo[WILDCARD]\nbaz[WILDCARD]\n", + "foobar\r\nbazqat\r\n", + true, + ), + ( + "foo[WILDCARD]\r\nbaz[WILDCARD]\n", + "foobar\nbazqat\r\n", + true, + ), + ( + "foo[WILDCARD]\r\nbaz[WILDCARD]\r\n", + "foobar\nbazqat\n", + true, + ), + ( + "foo[WILDCARD]\r\nbaz[WILDCARD]\r\n", + "foobar\r\nbazqat\r\n", + true, + ), + ]; + + // Iterate through the fixture lists, testing each one + for (pattern, string, expected) in fixtures { + let actual = wildcard_match(pattern, string); + dbg!(pattern, string, expected); + assert_eq!(actual, expected); + } +} + +#[test] +fn test_pattern_match() { + assert!(pattern_match("foo[BAR]baz", "foobarbaz", "[BAR]")); + assert!(!pattern_match("foo[BAR]baz", "foobazbar", "[BAR]")); +} diff --git a/cli/main.rs b/cli/main.rs index 42369e638a..30acb3ebd1 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -18,6 +18,9 @@ extern crate serde; extern crate serde_derive; extern crate url; +#[cfg(test)] +mod integration_tests; + mod ansi; mod assets; pub mod compilers; diff --git a/tests/001_hello.test b/tests/001_hello.test deleted file mode 100644 index 27cc21f338..0000000000 --- a/tests/001_hello.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/001_hello.js -output: tests/001_hello.js.out diff --git a/tests/002_hello.test b/tests/002_hello.test deleted file mode 100644 index 412b2ac795..0000000000 --- a/tests/002_hello.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/002_hello.ts -output: tests/002_hello.ts.out diff --git a/tests/003_relative_import.test b/tests/003_relative_import.test deleted file mode 100644 index 0f69633e0a..0000000000 --- a/tests/003_relative_import.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/003_relative_import.ts -output: tests/003_relative_import.ts.out diff --git a/tests/004_set_timeout.test b/tests/004_set_timeout.test deleted file mode 100644 index e4a534f48b..0000000000 --- a/tests/004_set_timeout.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/004_set_timeout.ts -output: tests/004_set_timeout.ts.out diff --git a/tests/005_more_imports.test b/tests/005_more_imports.test deleted file mode 100644 index 3bc2e999d2..0000000000 --- a/tests/005_more_imports.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/005_more_imports.ts -output: tests/005_more_imports.ts.out diff --git a/tests/006_url_imports.test b/tests/006_url_imports.test deleted file mode 100644 index 28d9116f71..0000000000 --- a/tests/006_url_imports.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/006_url_imports.ts -output: tests/006_url_imports.ts.out diff --git a/tests/012_async.test b/tests/012_async.test deleted file mode 100644 index 63a0e0d237..0000000000 --- a/tests/012_async.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/012_async.ts -output: tests/012_async.ts.out diff --git a/tests/013_dynamic_import.test b/tests/013_dynamic_import.test deleted file mode 100644 index d65139dfa7..0000000000 --- a/tests/013_dynamic_import.test +++ /dev/null @@ -1,2 +0,0 @@ -args: tests/013_dynamic_import.ts --reload --allow-read -output: tests/013_dynamic_import.ts.out diff --git a/tests/014_duplicate_import.test b/tests/014_duplicate_import.test deleted file mode 100644 index c4811a32c4..0000000000 --- a/tests/014_duplicate_import.test +++ /dev/null @@ -1,2 +0,0 @@ -args: tests/014_duplicate_import.ts --reload --allow-read -output: tests/014_duplicate_import.ts.out diff --git a/tests/015_duplicate_parallel_import.test b/tests/015_duplicate_parallel_import.test deleted file mode 100644 index 8378277953..0000000000 --- a/tests/015_duplicate_parallel_import.test +++ /dev/null @@ -1,2 +0,0 @@ -args: tests/015_duplicate_parallel_import.js --reload --allow-read -output: tests/015_duplicate_parallel_import.js.out diff --git a/tests/016_double_await.test b/tests/016_double_await.test deleted file mode 100644 index a1448e5a1e..0000000000 --- a/tests/016_double_await.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --allow-read --reload tests/016_double_await.ts -output: tests/016_double_await.ts.out diff --git a/tests/017_import_redirect.test b/tests/017_import_redirect.test deleted file mode 100644 index d8e7570db2..0000000000 --- a/tests/017_import_redirect.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/017_import_redirect.ts -output: tests/017_import_redirect.ts.out diff --git a/tests/018_async_catch.test b/tests/018_async_catch.test deleted file mode 100644 index ee62836ab8..0000000000 --- a/tests/018_async_catch.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/018_async_catch.ts -output: tests/018_async_catch.ts.out diff --git a/tests/019_media_types.test b/tests/019_media_types.test deleted file mode 100644 index d311abc101..0000000000 --- a/tests/019_media_types.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/019_media_types.ts -output: tests/019_media_types.ts.out diff --git a/tests/020_json_modules.test b/tests/020_json_modules.test deleted file mode 100644 index 624d69db33..0000000000 --- a/tests/020_json_modules.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/020_json_modules.ts -output: tests/020_json_modules.ts.out diff --git a/tests/021_mjs_modules.test b/tests/021_mjs_modules.test deleted file mode 100644 index b74554fb1f..0000000000 --- a/tests/021_mjs_modules.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/021_mjs_modules.ts -output: tests/021_mjs_modules.ts.out diff --git a/tests/022_info_flag_script.test b/tests/022_info_flag_script.test deleted file mode 100644 index ba11b98150..0000000000 --- a/tests/022_info_flag_script.test +++ /dev/null @@ -1,4 +0,0 @@ -# The output assumes 003_relative_import.ts has already been run earlier -# and its output is cached to $DENO_DIR. -args: info http://127.0.0.1:4545/tests/019_media_types.ts -output: tests/022_info_flag_script.out diff --git a/tests/023_no_ext_with_headers.test b/tests/023_no_ext_with_headers.test deleted file mode 100644 index cbab7cabd1..0000000000 --- a/tests/023_no_ext_with_headers.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/023_no_ext_with_headers -output: tests/023_no_ext_with_headers.out diff --git a/tests/024_import_no_ext_with_headers.test b/tests/024_import_no_ext_with_headers.test deleted file mode 100644 index 8f51bc8feb..0000000000 --- a/tests/024_import_no_ext_with_headers.test +++ /dev/null @@ -1,3 +0,0 @@ -# FIXME(bartlomieju): this test should use remote file -# args: run --reload tests/024_import_no_ext_with_headers.ts -# output: tests/024_import_no_ext_with_headers.ts.out diff --git a/tests/025_hrtime.test b/tests/025_hrtime.test deleted file mode 100644 index 3b25452ac2..0000000000 --- a/tests/025_hrtime.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --allow-hrtime --reload tests/025_hrtime.ts -output: tests/025_hrtime.ts.out diff --git a/tests/025_reload_js_type_error.test b/tests/025_reload_js_type_error.test deleted file mode 100644 index d88c1c5782..0000000000 --- a/tests/025_reload_js_type_error.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/025_reload_js_type_error.js -output: tests/025_reload_js_type_error.js.out diff --git a/tests/026_redirect_javascript.js.test b/tests/026_redirect_javascript.js.test deleted file mode 100644 index 2b1f0d522d..0000000000 --- a/tests/026_redirect_javascript.js.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/026_redirect_javascript.js -output: tests/026_redirect_javascript.js.out diff --git a/tests/026_workers.test b/tests/026_workers.test deleted file mode 100644 index 1d973a6c52..0000000000 --- a/tests/026_workers.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/026_workers.ts -output: tests/026_workers.ts.out diff --git a/tests/027_redirect_typescript.ts.test b/tests/027_redirect_typescript.ts.test deleted file mode 100644 index ba2525ff6f..0000000000 --- a/tests/027_redirect_typescript.ts.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/027_redirect_typescript.ts -output: tests/027_redirect_typescript.ts.out diff --git a/tests/028_args.test b/tests/028_args.test deleted file mode 100644 index af98c8b7a5..0000000000 --- a/tests/028_args.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/028_args.ts --arg1 val1 --arg2=val2 -- arg3 arg4 -output: tests/028_args.ts.out diff --git a/tests/028_args.ts.out b/tests/028_args.ts.out index 003599c0d0..fa36f6e4c8 100644 --- a/tests/028_args.ts.out +++ b/tests/028_args.ts.out @@ -1,4 +1,4 @@ -tests/028_args.ts +028_args.ts --arg1 val1 --arg2=val2 diff --git a/tests/029_eval.test b/tests/029_eval.test deleted file mode 100644 index 3b3eb029e1..0000000000 --- a/tests/029_eval.test +++ /dev/null @@ -1,2 +0,0 @@ -args: eval console.log("hello") -output: tests/029_eval.out diff --git a/tests/030_xeval.test b/tests/030_xeval.test deleted file mode 100644 index 3ecff4153c..0000000000 --- a/tests/030_xeval.test +++ /dev/null @@ -1,3 +0,0 @@ -args: xeval console.log($.toUpperCase()) -input: a\nb\n\nc -output: tests/030_xeval.out diff --git a/tests/031_xeval_replvar.test b/tests/031_xeval_replvar.test deleted file mode 100644 index ebadb6d28c..0000000000 --- a/tests/031_xeval_replvar.test +++ /dev/null @@ -1,3 +0,0 @@ -args: xeval -I val console.log(val.toUpperCase()); -input: a\nb\n\nc -output: tests/031_xeval_replvar.out diff --git a/tests/032_xeval_delim.test b/tests/032_xeval_delim.test deleted file mode 100644 index b4d8342fc7..0000000000 --- a/tests/032_xeval_delim.test +++ /dev/null @@ -1,3 +0,0 @@ -args: xeval -d DELIM console.log($.toUpperCase()); -input: aDELIMbDELIMDELIMc -output: tests/032_xeval_delim.out diff --git a/tests/033_import_map.test b/tests/033_import_map.test deleted file mode 100644 index 1633c1807f..0000000000 --- a/tests/033_import_map.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload --importmap=tests/importmaps/import_map.json tests/importmaps/test.ts -output: tests/033_import_map.out diff --git a/tests/034_onload.test b/tests/034_onload.test deleted file mode 100644 index d3105656f6..0000000000 --- a/tests/034_onload.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/034_onload/main.ts -output: tests/034_onload.out diff --git a/tests/035_no_fetch_flag.out b/tests/035_no_fetch_flag.out index 7b5fdd44fa..0c835830ca 100644 --- a/tests/035_no_fetch_flag.out +++ b/tests/035_no_fetch_flag.out @@ -1 +1 @@ -success true true true true true true true true +Cannot resolve module "http://127.0.0.1:4545/tests/019_media_types.ts" diff --git a/tests/035_no_fetch_flag.test b/tests/035_no_fetch_flag.test deleted file mode 100644 index c71e88e0c7..0000000000 --- a/tests/035_no_fetch_flag.test +++ /dev/null @@ -1,4 +0,0 @@ -# The output assumes 003_relative_import.ts has already been run earlier -# and its output is cached to $DENO_DIR. -args: --no-fetch http://127.0.0.1:4545/tests/019_media_types.ts -output: tests/035_no_fetch_flag.out diff --git a/tests/036_import_map_fetch.test b/tests/036_import_map_fetch.test deleted file mode 100644 index 962573587a..0000000000 --- a/tests/036_import_map_fetch.test +++ /dev/null @@ -1,2 +0,0 @@ -args: fetch --reload --importmap=tests/importmaps/import_map.json tests/importmaps/test.ts -output: tests/036_import_map_fetch.out diff --git a/tests/037_current_thread.test b/tests/037_current_thread.test deleted file mode 100644 index 8cc8e37a33..0000000000 --- a/tests/037_current_thread.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --current-thread --reload tests/034_onload/main.ts -output: tests/034_onload.out diff --git a/tests/038_checkjs.test b/tests/038_checkjs.test deleted file mode 100644 index 6385c9bb78..0000000000 --- a/tests/038_checkjs.test +++ /dev/null @@ -1,5 +0,0 @@ -# checking if JS file is run through TS compiler -args: run --reload --config tests/038_checkjs.tsconfig.json tests/038_checkjs.js -check_stderr: true -exit_code: 1 -output: tests/038_checkjs.js.out diff --git a/tests/039_worker_deno_ns.test b/tests/039_worker_deno_ns.test deleted file mode 100644 index da282cc7b1..0000000000 --- a/tests/039_worker_deno_ns.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/039_worker_deno_ns.ts -output: tests/039_worker_deno_ns.ts.out diff --git a/tests/040_worker_blob.test b/tests/040_worker_blob.test deleted file mode 100644 index 81fd3182e4..0000000000 --- a/tests/040_worker_blob.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/040_worker_blob.ts -output: tests/040_worker_blob.ts.out diff --git a/tests/041_dyn_import_eval.test b/tests/041_dyn_import_eval.test deleted file mode 100644 index b9baf52252..0000000000 --- a/tests/041_dyn_import_eval.test +++ /dev/null @@ -1,2 +0,0 @@ -args: eval import('./tests/subdir/mod4.js').then(console.log) -output: tests/041_dyn_import_eval.out diff --git a/tests/041_info_flag.test b/tests/041_info_flag.test deleted file mode 100644 index 2cabb652ce..0000000000 --- a/tests/041_info_flag.test +++ /dev/null @@ -1,2 +0,0 @@ -args: info -output: tests/041_info_flag.out diff --git a/tests/042_dyn_import_evalcontext.test b/tests/042_dyn_import_evalcontext.test deleted file mode 100644 index ab1efc084d..0000000000 --- a/tests/042_dyn_import_evalcontext.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --allow-read --reload tests/042_dyn_import_evalcontext.ts -output: tests/042_dyn_import_evalcontext.ts.out diff --git a/tests/042_dyn_import_evalcontext.ts b/tests/042_dyn_import_evalcontext.ts index ef643ae465..124a406d24 100644 --- a/tests/042_dyn_import_evalcontext.ts +++ b/tests/042_dyn_import_evalcontext.ts @@ -1,4 +1,4 @@ // @ts-ignore Deno.core.evalContext( - "(async () => console.log(await import('./tests/subdir/mod4.js')))()" + "(async () => console.log(await import('./subdir/mod4.js')))()" ); diff --git a/tests/async_error.test b/tests/async_error.test deleted file mode 100644 index 2cc8de9224..0000000000 --- a/tests/async_error.test +++ /dev/null @@ -1,4 +0,0 @@ -exit_code: 1 -args: run --reload tests/async_error.ts -check_stderr: true -output: tests/async_error.ts.out diff --git a/tests/circular1.test b/tests/circular1.test deleted file mode 100644 index 80afb035b4..0000000000 --- a/tests/circular1.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/circular1.js -output: tests/circular1.js.out diff --git a/tests/config.test b/tests/config.test deleted file mode 100644 index d8c5fde997..0000000000 --- a/tests/config.test +++ /dev/null @@ -1,4 +0,0 @@ -args: run --reload --config tests/config.tsconfig.json tests/config.ts -check_stderr: true -exit_code: 1 -output: tests/config.ts.out diff --git a/tests/error_001.test b/tests/error_001.test deleted file mode 100644 index df1ee5f4a2..0000000000 --- a/tests/error_001.test +++ /dev/null @@ -1,4 +0,0 @@ -args: run --reload tests/error_001.ts -check_stderr: true -exit_code: 1 -output: tests/error_001.ts.out diff --git a/tests/error_002.test b/tests/error_002.test deleted file mode 100644 index d2954506d1..0000000000 --- a/tests/error_002.test +++ /dev/null @@ -1,4 +0,0 @@ -args: run --reload tests/error_002.ts -check_stderr: true -exit_code: 1 -output: tests/error_002.ts.out diff --git a/tests/error_003_typescript.test b/tests/error_003_typescript.test deleted file mode 100644 index a7a68627ac..0000000000 --- a/tests/error_003_typescript.test +++ /dev/null @@ -1,4 +0,0 @@ -args: run --reload tests/error_003_typescript.ts -check_stderr: true -exit_code: 1 -output: tests/error_003_typescript.ts.out diff --git a/tests/error_003_typescript2.test b/tests/error_003_typescript2.test deleted file mode 100644 index c4c724259c..0000000000 --- a/tests/error_003_typescript2.test +++ /dev/null @@ -1,8 +0,0 @@ -# Supposing that we've already attempted to run error_003_typescript.ts -# we want to make sure that JS wasn't emitted. Running again without reload flag -# should result in the same output. -# https://github.com/denoland/deno/issues/2436 -args: run tests/error_003_typescript.ts -check_stderr: true -exit_code: 1 -output: tests/error_003_typescript.ts.out diff --git a/tests/error_004_missing_module.test b/tests/error_004_missing_module.test deleted file mode 100644 index 99c25908c7..0000000000 --- a/tests/error_004_missing_module.test +++ /dev/null @@ -1,4 +0,0 @@ -args: run --reload tests/error_004_missing_module.ts -check_stderr: true -exit_code: 1 -output: tests/error_004_missing_module.ts.out diff --git a/tests/error_005_missing_dynamic_import.test b/tests/error_005_missing_dynamic_import.test deleted file mode 100644 index ffbf20be90..0000000000 --- a/tests/error_005_missing_dynamic_import.test +++ /dev/null @@ -1,4 +0,0 @@ -args: run --reload tests/error_005_missing_dynamic_import.ts -check_stderr: true -exit_code: 1 -output: tests/error_005_missing_dynamic_import.ts.out diff --git a/tests/error_006_import_ext_failure.test b/tests/error_006_import_ext_failure.test deleted file mode 100644 index 59a82a3641..0000000000 --- a/tests/error_006_import_ext_failure.test +++ /dev/null @@ -1,4 +0,0 @@ -args: run --reload tests/error_006_import_ext_failure.ts -check_stderr: true -exit_code: 1 -output: tests/error_006_import_ext_failure.ts.out diff --git a/tests/error_007_any.test b/tests/error_007_any.test deleted file mode 100644 index a9f99052a5..0000000000 --- a/tests/error_007_any.test +++ /dev/null @@ -1,4 +0,0 @@ -args: run --reload tests/error_007_any.ts -check_stderr: true -exit_code: 1 -output: tests/error_007_any.ts.out diff --git a/tests/error_008_checkjs.test b/tests/error_008_checkjs.test deleted file mode 100644 index ae3a5414a1..0000000000 --- a/tests/error_008_checkjs.test +++ /dev/null @@ -1,4 +0,0 @@ -args: run --reload tests/error_008_checkjs.js -check_stderr: true -exit_code: 1 -output: tests/error_008_checkjs.js.out diff --git a/tests/error_011_bad_module_specifier.test b/tests/error_011_bad_module_specifier.test deleted file mode 100644 index b2e125cfa9..0000000000 --- a/tests/error_011_bad_module_specifier.test +++ /dev/null @@ -1,4 +0,0 @@ -args: run --reload tests/error_011_bad_module_specifier.ts -check_stderr: true -exit_code: 1 -output: tests/error_011_bad_module_specifier.ts.out diff --git a/tests/error_012_bad_dynamic_import_specifier.test b/tests/error_012_bad_dynamic_import_specifier.test deleted file mode 100644 index d0c25608d8..0000000000 --- a/tests/error_012_bad_dynamic_import_specifier.test +++ /dev/null @@ -1,4 +0,0 @@ -args: run --reload tests/error_012_bad_dynamic_import_specifier.ts -check_stderr: true -exit_code: 1 -output: tests/error_012_bad_dynamic_import_specifier.ts.out diff --git a/tests/error_013_missing_script.test b/tests/error_013_missing_script.test deleted file mode 100644 index 76c77da8d2..0000000000 --- a/tests/error_013_missing_script.test +++ /dev/null @@ -1,4 +0,0 @@ -args: run --reload missing_file_name -check_stderr: true -exit_code: 1 -output: tests/error_013_missing_script.out diff --git a/tests/error_014_catch_dynamic_import_error.test b/tests/error_014_catch_dynamic_import_error.test deleted file mode 100644 index 13ece48434..0000000000 --- a/tests/error_014_catch_dynamic_import_error.test +++ /dev/null @@ -1,2 +0,0 @@ -args: tests/error_014_catch_dynamic_import_error.js --reload --allow-read -output: tests/error_014_catch_dynamic_import_error.js.out diff --git a/tests/error_015_dynamic_import_permissions.test b/tests/error_015_dynamic_import_permissions.test deleted file mode 100644 index 62f31e6b36..0000000000 --- a/tests/error_015_dynamic_import_permissions.test +++ /dev/null @@ -1,4 +0,0 @@ -args: --reload --no-prompt tests/error_015_dynamic_import_permissions.js -output: tests/error_015_dynamic_import_permissions.out -check_stderr: true -exit_code: 1 diff --git a/tests/error_016_dynamic_import_permissions2.test b/tests/error_016_dynamic_import_permissions2.test deleted file mode 100644 index 0fc514f0f7..0000000000 --- a/tests/error_016_dynamic_import_permissions2.test +++ /dev/null @@ -1,5 +0,0 @@ -# We have an allow-net flag but not allow-read, it should still result in error. -args: --no-prompt --reload --allow-net tests/error_016_dynamic_import_permissions2.js -output: tests/error_016_dynamic_import_permissions2.out -check_stderr: true -exit_code: 1 diff --git a/tests/error_stack.test b/tests/error_stack.test deleted file mode 100644 index 88de56958a..0000000000 --- a/tests/error_stack.test +++ /dev/null @@ -1,4 +0,0 @@ -args: run --reload tests/error_stack.ts -check_stderr: true -exit_code: 1 -output: tests/error_stack.ts.out diff --git a/tests/error_syntax.test b/tests/error_syntax.test deleted file mode 100644 index 9222261125..0000000000 --- a/tests/error_syntax.test +++ /dev/null @@ -1,4 +0,0 @@ -args: run --reload tests/error_syntax.js -check_stderr: true -exit_code: 1 -output: tests/error_syntax.js.out diff --git a/tests/error_type_definitions.test b/tests/error_type_definitions.test deleted file mode 100644 index 367edacc5e..0000000000 --- a/tests/error_type_definitions.test +++ /dev/null @@ -1,4 +0,0 @@ -args: run --reload tests/error_type_definitions.ts -check_stderr: true -exit_code: 1 -output: tests/error_type_definitions.ts.out diff --git a/tests/exit_error42.test b/tests/exit_error42.test deleted file mode 100644 index e2c196f6fb..0000000000 --- a/tests/exit_error42.test +++ /dev/null @@ -1,3 +0,0 @@ -exit_code: 42 -args: run --reload tests/exit_error42.ts -output: tests/exit_error42.ts.out diff --git a/tests/https_import.test b/tests/https_import.test deleted file mode 100644 index 1235548dad..0000000000 --- a/tests/https_import.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/https_import.ts -output: tests/https_import.ts.out diff --git a/tests/if_main.test b/tests/if_main.test deleted file mode 100644 index c72c89866d..0000000000 --- a/tests/if_main.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/if_main.ts -output: tests/if_main.ts.out diff --git a/tests/import_meta.test b/tests/import_meta.test deleted file mode 100644 index d38f2d939b..0000000000 --- a/tests/import_meta.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/import_meta.ts -output: tests/import_meta.ts.out diff --git a/tests/seed_random.test b/tests/seed_random.test deleted file mode 100644 index 20a3b3c8e2..0000000000 --- a/tests/seed_random.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --seed=100 tests/seed_random.js -output: tests/seed_random.js.out diff --git a/tests/type_definitions.test b/tests/type_definitions.test deleted file mode 100644 index 7ce8d896d6..0000000000 --- a/tests/type_definitions.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/type_definitions.ts -output: tests/type_definitions.ts.out diff --git a/tests/types.test b/tests/types.test deleted file mode 100644 index 3fd4e6fe72..0000000000 --- a/tests/types.test +++ /dev/null @@ -1,2 +0,0 @@ -args: types -output: tests/types.out diff --git a/tests/unbuffered_stderr.test b/tests/unbuffered_stderr.test deleted file mode 100644 index 366c1c445c..0000000000 --- a/tests/unbuffered_stderr.test +++ /dev/null @@ -1,3 +0,0 @@ -args: run --reload tests/unbuffered_stderr.ts -check_stderr: true -output: tests/unbuffered_stderr.ts.out diff --git a/tests/unbuffered_stdout.test b/tests/unbuffered_stdout.test deleted file mode 100644 index 7caa057082..0000000000 --- a/tests/unbuffered_stdout.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --reload tests/unbuffered_stdout.ts -output: tests/unbuffered_stdout.ts.out diff --git a/tests/v8_flags.test b/tests/v8_flags.test deleted file mode 100644 index 50e00be025..0000000000 --- a/tests/v8_flags.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run --v8-flags=--expose-gc tests/v8_flags.js -output: tests/v8_flags.js.out diff --git a/tests/v8_help.test b/tests/v8_help.test deleted file mode 100644 index 2fe105654a..0000000000 --- a/tests/v8_help.test +++ /dev/null @@ -1,2 +0,0 @@ -args: --v8-options -output: tests/v8_help.out diff --git a/tests/version.test b/tests/version.test deleted file mode 100644 index 24079f715e..0000000000 --- a/tests/version.test +++ /dev/null @@ -1,2 +0,0 @@ -args: version -output: tests/version.out diff --git a/tests/version_long_flag.test b/tests/version_long_flag.test deleted file mode 100644 index ab521879bf..0000000000 --- a/tests/version_long_flag.test +++ /dev/null @@ -1,2 +0,0 @@ -args: --version -output: tests/version.out diff --git a/tests/version_short_flag.test b/tests/version_short_flag.test deleted file mode 100644 index 2078ce874e..0000000000 --- a/tests/version_short_flag.test +++ /dev/null @@ -1,2 +0,0 @@ -args: -v -output: tests/version.out diff --git a/tests/wasm.test b/tests/wasm.test deleted file mode 100644 index c4c3996705..0000000000 --- a/tests/wasm.test +++ /dev/null @@ -1,2 +0,0 @@ -args: run tests/wasm.ts -output: tests/wasm.ts.out diff --git a/tests/wasm_async.test b/tests/wasm_async.test deleted file mode 100644 index 534921a966..0000000000 --- a/tests/wasm_async.test +++ /dev/null @@ -1,2 +0,0 @@ -args: tests/wasm_async.js -output: tests/wasm_async.out diff --git a/tools/integration_tests.py b/tools/integration_tests.py deleted file mode 100755 index dd65feaf90..0000000000 --- a/tools/integration_tests.py +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -# Given a deno executable, this script executes several integration tests with -# it. The tests are stored in /tests/ and each is specified in a .yaml file -# where a description, command line, and output are specified. Optionally an -# exit code can be specified. -# -# Usage: integration_tests.py [path to deno executable] -import os -import re -import subprocess - -import http_server -from test_util import DenoTestCase, run_tests -from util import root_path, tests_path, pattern_match, rmtree - - -def strip_ansi_codes(s): - ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]') - return ansi_escape.sub('', s) - - -def read_test(file_name): - with open(file_name, "r") as f: - test_file = f.read() - lines = test_file.splitlines() - test_dict = {} - for line in lines: - if line.strip().startswith("#"): - # skip comments - continue - key, value = re.split(r":\s+", line) - test_dict[key] = value - return test_dict - - -def str2bool(v): - if v == "true": - return True - elif v == "false": - return False - else: - raise ValueError("Bad boolean value") - - -class TestIntegrations(DenoTestCase): - @classmethod - def _test(cls, test_filename): - # Return thunk to test for js file, - # This is to 'trick' unittest so as to generate these dynamically. - return lambda self: self.generate(test_filename) - - def generate(self, test_filename): - test_abs = os.path.join(tests_path, test_filename) - test = read_test(test_abs) - exit_code = int(test.get("exit_code", 0)) - args = test.get("args", None) - - if not args: - return - - # TODO(kevinkassimo): better args parsing with quotation marks. - args = args.split(" ") - check_stderr = str2bool(test.get("check_stderr", "false")) - stderr = subprocess.STDOUT if check_stderr else open(os.devnull, 'w') - stdin_input = (test.get("input", - "").strip().decode("string_escape").replace( - "\r\n", "\n")) - has_stdin_input = len(stdin_input) > 0 - - output_abs = os.path.join(root_path, test.get("output", "")) - with open(output_abs, 'r') as f: - expected_out = f.read() - cmd = [self.deno_exe] + args - actual_code = 0 - try: - if has_stdin_input: - # Provided stdin - proc = subprocess.Popen( - cmd, - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=stderr) - actual_out, _ = proc.communicate(stdin_input) - actual_out = actual_out.replace("\r\n", "\n") - else: - # No stdin sent - actual_out = subprocess.check_output( - cmd, universal_newlines=True, stderr=stderr) - - except subprocess.CalledProcessError as e: - actual_code = e.returncode - actual_out = e.output - - actual_out = strip_ansi_codes(actual_out) - if not pattern_match(expected_out, actual_out): - # This will always throw since pattern_match failed. - self.assertEqual(expected_out, actual_out) - - self.assertEqual(exit_code, actual_code) - - -# Add a methods for each test file in tests_path. -for fn in sorted( - filename for filename in os.listdir(tests_path) - if filename.endswith(".test")): - - t = TestIntegrations._test(fn) - tn = t.__name__ = "test_" + fn.split(".")[0] - setattr(TestIntegrations, tn, t) - -if __name__ == "__main__": - with http_server.spawn(): - run_tests() diff --git a/tools/test.py b/tools/test.py index 3f8e74ecdc..9cd2f7a46b 100755 --- a/tools/test.py +++ b/tools/test.py @@ -8,7 +8,6 @@ from benchmark_test import TestBenchmark from deno_dir_test import TestDenoDir from fetch_test import TestFetch from fmt_test import TestFmt -from integration_tests import TestIntegrations from repl_test import TestRepl from setup_test import TestSetup from target_test import TestTarget @@ -41,7 +40,6 @@ def main(): TestTarget, JsUnitTests, TestFetch, - TestIntegrations, TestRepl, TestDenoDir, TestBenchmark, diff --git a/tools/util.py b/tools/util.py index 39eaf68637..89b288a11e 100644 --- a/tools/util.py +++ b/tools/util.py @@ -214,34 +214,6 @@ def build_path(): return os.path.join(root_path, "target", build_mode()) -# Returns True if the expected matches the actual output, allowing variation -# from actual where expected has the wildcard (e.g. matches /.*/) -def pattern_match(pattern, string, wildcard="[WILDCARD]"): - if pattern == wildcard: - return True - - parts = str.split(pattern, wildcard) - - if len(parts) == 1: - return pattern == string - - if string.startswith(parts[0]): - string = string[len(parts[0]):] - else: - return False - - for i in range(1, len(parts)): - if i == (len(parts) - 1): - if parts[i] == "" or parts[i] == "\n": - return True - found = string.find(parts[i]) - if found < 0: - return False - string = string[(found + len(parts[i])):] - - return len(string) == 0 - - def parse_exit_code(s): codes = [int(d or 1) for d in re.findall(r'error(\d*)', s)] if len(codes) > 1: diff --git a/tools/util_test.py b/tools/util_test.py index 0a718f1d99..4a545ff1ce 100755 --- a/tools/util_test.py +++ b/tools/util_test.py @@ -2,35 +2,11 @@ import os from test_util import DenoTestCase, run_tests -from util import (pattern_match, parse_exit_code, shell_quote_win, - parse_wrk_output, root_path) +from util import (parse_exit_code, shell_quote_win, parse_wrk_output, + root_path) class TestUtil(DenoTestCase): - def test_pattern_match(self): - # yapf: disable - fixtures = [("foobarbaz", "foobarbaz", True), - ("[WILDCARD]", "foobarbaz", True), - ("foobar", "foobarbaz", False), - ("foo[WILDCARD]baz", "foobarbaz", True), - ("foo[WILDCARD]baz", "foobazbar", False), - ("foo[WILDCARD]baz[WILDCARD]qux", "foobarbazqatqux", True), - ("foo[WILDCARD]", "foobar", True), - ("foo[WILDCARD]baz[WILDCARD]", "foobarbazqat", True)] - # yapf: enable - - # Iterate through the fixture lists, testing each one - for (pattern, string, expected) in fixtures: - actual = pattern_match(pattern, string) - assert expected == actual, \ - "expected %s for\nExpected:\n%s\nTo equal actual:\n%s" % ( - expected, pattern, string) - - assert pattern_match("foo[BAR]baz", "foobarbaz", - "[BAR]") == True, "expected wildcard to be set" - assert pattern_match("foo[BAR]baz", "foobazbar", - "[BAR]") == False, "expected wildcard to be set" - def test_parse_exit_code(self): assert 54 == parse_exit_code('hello_error54_world') assert 1 == parse_exit_code('hello_error_world')