summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorCasper Beyer <caspervonb@pm.me>2021-02-02 19:05:46 +0800
committerGitHub <noreply@github.com>2021-02-02 12:05:46 +0100
commit6abf126c2a7a451cded8c6b5e6ddf1b69c84055d (patch)
treefd94c013a19fcb38954844085821ec1601c20e18 /cli
parenta2b5d44f1aa9d64f448a2a3cc2001272e2f60b98 (diff)
chore: remove std directory (#9361)
This removes the std folder from the tree. Various parts of the tests are pretty tightly dependent on std (47 direct imports and 75 indirect imports, not counting the cli tests that use them as fixtures) so I've added std as a submodule for now.
Diffstat (limited to 'cli')
-rw-r--r--cli/bench/deno_http_proxy.ts2
-rw-r--r--cli/bench/http.rs2
-rw-r--r--cli/bench/main.rs20
-rw-r--r--cli/http_util.rs8
-rw-r--r--cli/tests/034_onload/imported.ts2
-rw-r--r--cli/tests/034_onload/main.ts2
-rw-r--r--cli/tests/034_onload/nest_imported.ts2
-rw-r--r--cli/tests/045_proxy_client.ts4
-rw-r--r--cli/tests/045_proxy_test.ts8
-rw-r--r--cli/tests/045_proxy_test.ts.out6
-rw-r--r--cli/tests/compiler_api_test.ts2
-rw-r--r--cli/tests/hash.ts64
-rw-r--r--cli/tests/integration_tests.rs38
-rw-r--r--cli/tests/test_runner_test.ts2
-rw-r--r--cli/tests/unit/blob_test.ts4
-rw-r--r--cli/tests/unit/console_test.ts2
-rw-r--r--cli/tests/unit/test_util.ts17
-rw-r--r--cli/tests/unit/tls_test.ts4
-rw-r--r--cli/tests/websocket_test.ts4
-rw-r--r--cli/tests/workers/parent_read_check_granular_worker.js2
-rw-r--r--cli/tests/workers/read_check_granular_worker.js2
-rw-r--r--cli/tests/workers_round_robin_bench.ts2
-rw-r--r--cli/tests/workers_test.ts4
-rw-r--r--cli/tools/test_runner.rs7
24 files changed, 64 insertions, 146 deletions
diff --git a/cli/bench/deno_http_proxy.ts b/cli/bench/deno_http_proxy.ts
index 990014831..fc756f80f 100644
--- a/cli/bench/deno_http_proxy.ts
+++ b/cli/bench/deno_http_proxy.ts
@@ -1,5 +1,5 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-import { serve, ServerRequest } from "../std/http/server.ts";
+import { serve, ServerRequest } from "../test_util/std/http/server.ts";
const addr = Deno.args[0] || "127.0.0.1:4500";
const originAddr = Deno.args[1] || "127.0.0.1:4501";
diff --git a/cli/bench/http.rs b/cli/bench/http.rs
index cf70a78cc..af7eef942 100644
--- a/cli/bench/http.rs
+++ b/cli/bench/http.rs
@@ -191,7 +191,7 @@ fn deno_http(deno_exe: &str) -> Result<HttpBenchmarkResult> {
"--allow-net",
"--reload",
"--unstable",
- "std/http/bench.ts",
+ "test_util/std/http/bench.ts",
&server_addr(port),
],
port,
diff --git a/cli/bench/main.rs b/cli/bench/main.rs
index 4f6465925..352c93010 100644
--- a/cli/bench/main.rs
+++ b/cli/bench/main.rs
@@ -79,7 +79,11 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
),
(
"check",
- &["cache", "--reload", "std/examples/chat/server_test.ts"],
+ &[
+ "cache",
+ "--reload",
+ "test_util/std/examples/chat/server_test.ts",
+ ],
None,
),
(
@@ -88,18 +92,22 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
"cache",
"--reload",
"--no-check",
- "std/examples/chat/server_test.ts",
+ "test_util/std/examples/chat/server_test.ts",
],
None,
),
(
"bundle",
- &["bundle", "std/examples/chat/server_test.ts"],
+ &["bundle", "test_util/std/examples/chat/server_test.ts"],
None,
),
(
"bundle_no_check",
- &["bundle", "--no-check", "std/examples/chat/server_test.ts"],
+ &[
+ "bundle",
+ "--no-check",
+ "test_util/std/examples/chat/server_test.ts",
+ ],
None,
),
];
@@ -254,8 +262,8 @@ fn get_binary_sizes(target_dir: &PathBuf) -> Result<HashMap<String, u64>> {
}
const BUNDLES: &[(&str, &str)] = &[
- ("file_server", "./std/http/file_server.ts"),
- ("gist", "./std/examples/gist.ts"),
+ ("file_server", "./test_util/std/http/file_server.ts"),
+ ("gist", "./test_util/std/examples/gist.ts"),
];
fn bundle_benchmark(deno_exe: &PathBuf) -> Result<HashMap<String, u64>> {
let mut sizes = HashMap::<String, u64>::new();
diff --git a/cli/http_util.rs b/cli/http_util.rs
index 4513dbfac..5b6274309 100644
--- a/cli/http_util.rs
+++ b/cli/http_util.rs
@@ -313,7 +313,7 @@ mod tests {
Some(
read(
test_util::root_path()
- .join("std/http/testdata/tls/RootCA.pem")
+ .join("cli/tests/tls/RootCA.pem")
.to_str()
.unwrap(),
)
@@ -345,7 +345,7 @@ mod tests {
Some(
read(
test_util::root_path()
- .join("std/http/testdata/tls/RootCA.pem")
+ .join("cli/tests/tls/RootCA.pem")
.to_str()
.unwrap(),
)
@@ -376,7 +376,7 @@ mod tests {
Some(
read(
test_util::root_path()
- .join("std/http/testdata/tls/RootCA.pem")
+ .join("cli/tests/tls/RootCA.pem")
.to_str()
.unwrap(),
)
@@ -416,7 +416,7 @@ mod tests {
Some(
read(
test_util::root_path()
- .join("std/http/testdata/tls/RootCA.pem")
+ .join("cli/tests/tls/RootCA.pem")
.to_str()
.unwrap(),
)
diff --git a/cli/tests/034_onload/imported.ts b/cli/tests/034_onload/imported.ts
index f9a7009b8..9e1411bea 100644
--- a/cli/tests/034_onload/imported.ts
+++ b/cli/tests/034_onload/imported.ts
@@ -1,4 +1,4 @@
-import { assert } from "../../../std/testing/asserts.ts";
+import { assert } from "../../../test_util/std/testing/asserts.ts";
import "./nest_imported.ts";
const handler = (e: Event): void => {
diff --git a/cli/tests/034_onload/main.ts b/cli/tests/034_onload/main.ts
index aca38869e..f8c48ba7b 100644
--- a/cli/tests/034_onload/main.ts
+++ b/cli/tests/034_onload/main.ts
@@ -1,4 +1,4 @@
-import { assert } from "../../../std/testing/asserts.ts";
+import { assert } from "../../../test_util/std/testing/asserts.ts";
import "./imported.ts";
assert(window.hasOwnProperty("onload"));
diff --git a/cli/tests/034_onload/nest_imported.ts b/cli/tests/034_onload/nest_imported.ts
index 6b4a40749..d43b8ebe7 100644
--- a/cli/tests/034_onload/nest_imported.ts
+++ b/cli/tests/034_onload/nest_imported.ts
@@ -1,4 +1,4 @@
-import { assert } from "../../../std/testing/asserts.ts";
+import { assert } from "../../../test_util/std/testing/asserts.ts";
const handler = (e: Event): void => {
assert(!e.cancelable);
diff --git a/cli/tests/045_proxy_client.ts b/cli/tests/045_proxy_client.ts
index c9ef43e81..316f0bf85 100644
--- a/cli/tests/045_proxy_client.ts
+++ b/cli/tests/045_proxy_client.ts
@@ -1,3 +1,5 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-const res = await fetch("http://localhost:4545/std/examples/colors.ts");
+const res = await fetch(
+ "http://localhost:4545/test_util/std/examples/colors.ts",
+);
console.log(`Response http: ${await res.text()}`);
diff --git a/cli/tests/045_proxy_test.ts b/cli/tests/045_proxy_test.ts
index 2fb45f5f0..c7ba5e967 100644
--- a/cli/tests/045_proxy_test.ts
+++ b/cli/tests/045_proxy_test.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-import { serve, ServerRequest } from "../../std/http/server.ts";
-import { assertEquals } from "../../std/testing/asserts.ts";
+import { serve, ServerRequest } from "../../test_util/std/http/server.ts";
+import { assertEquals } from "../../test_util/std/testing/asserts.ts";
const addr = Deno.args[1] || "127.0.0.1:4555";
@@ -54,7 +54,7 @@ async function testModuleDownload(): Promise<void> {
"cache",
"--reload",
"--quiet",
- "http://localhost:4545/std/examples/colors.ts",
+ "http://localhost:4545/test_util/std/examples/colors.ts",
],
stdout: "piped",
env: {
@@ -96,7 +96,7 @@ async function testModuleDownloadNoProxy(): Promise<void> {
"cache",
"--reload",
"--quiet",
- "http://localhost:4545/std/examples/colors.ts",
+ "http://localhost:4545/test_util/std/examples/colors.ts",
],
stdout: "piped",
env: {
diff --git a/cli/tests/045_proxy_test.ts.out b/cli/tests/045_proxy_test.ts.out
index c59f219a4..4b07438ec 100644
--- a/cli/tests/045_proxy_test.ts.out
+++ b/cli/tests/045_proxy_test.ts.out
@@ -1,4 +1,4 @@
Proxy server listening on [WILDCARD]
-Proxy request to: http://localhost:4545/std/examples/colors.ts
-Proxy request to: http://localhost:4545/std/examples/colors.ts
-Proxy request to: http://localhost:4545/std/fmt/colors.ts
+Proxy request to: http://localhost:4545/test_util/std/examples/colors.ts
+Proxy request to: http://localhost:4545/test_util/std/examples/colors.ts
+Proxy request to: http://localhost:4545/test_util/std/fmt/colors.ts
diff --git a/cli/tests/compiler_api_test.ts b/cli/tests/compiler_api_test.ts
index 4aac027cb..bcee2bc43 100644
--- a/cli/tests/compiler_api_test.ts
+++ b/cli/tests/compiler_api_test.ts
@@ -3,7 +3,7 @@ import {
assert,
assertEquals,
assertThrowsAsync,
-} from "../../std/testing/asserts.ts";
+} from "../../test_util/std/testing/asserts.ts";
Deno.test({
name: "Deno.emit() - sources provided",
diff --git a/cli/tests/hash.ts b/cli/tests/hash.ts
deleted file mode 100644
index 1215b8b95..000000000
--- a/cli/tests/hash.ts
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-
-const { args } = Deno;
-import { createHash, SupportedAlgorithm } from "../../std/hash/mod.ts";
-import { Md5 } from "../../std/hash/md5.ts";
-import { Sha1 } from "../../std/hash/sha1.ts";
-import { Sha256 } from "../../std/hash/sha256.ts";
-import { Sha512 } from "../../std/hash/sha512.ts";
-// deno-lint-ignore camelcase
-import { Sha3_224, Sha3_256, Sha3_384, Sha3_512 } from "../../std/hash/sha3.ts";
-
-if (args.length < 3) Deno.exit(0);
-
-const method = args[0];
-const alg = args[1];
-const inputFile = args[2];
-
-// deno-lint-ignore no-explicit-any
-function getJsHash(alg: string): any {
- switch (alg) {
- case "md5":
- return new Md5();
- case "sha1":
- return new Sha1();
- case "sha224":
- return new Sha256(true);
- case "sha256":
- return new Sha256();
- case "sha3-224":
- return new Sha3_224();
- case "sha3-256":
- return new Sha3_256();
- case "sha3-384":
- return new Sha3_384();
- case "sha3-512":
- return new Sha3_512();
- case "sha512":
- return new Sha512();
- default:
- return null;
- }
-}
-
-const f = Deno.openSync(inputFile, { read: true });
-const buffer = Deno.readAllSync(f);
-f.close();
-
-let hash = null;
-
-console.time("hash");
-if (method === "rust") {
- hash = createHash(alg as SupportedAlgorithm);
-} else if (method === "js") {
- hash = getJsHash(alg);
-}
-
-if (hash === null) {
- console.log(`unknown hash: ${alg}`);
- Deno.exit(1);
-}
-
-hash.update(buffer);
-hash.digest();
-console.timeEnd("hash");
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index e144d2236..b158c9b55 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -11,42 +11,6 @@ use tempfile::TempDir;
use test_util as util;
#[test]
-fn std_tests() {
- let dir = TempDir::new().expect("tempdir fail");
- let status = util::deno_cmd()
- .env("DENO_DIR", dir.path())
- .current_dir(util::root_path())
- .arg("test")
- .arg("--unstable")
- .arg("--seed=86") // Some tests rely on specific random numbers.
- .arg("-A")
- // .arg("-Ldebug")
- .arg("std/")
- .spawn()
- .unwrap()
- .wait()
- .unwrap();
- assert!(status.success());
-}
-
-#[test]
-fn std_lint() {
- let status = util::deno_cmd()
- .arg("lint")
- .arg("--unstable")
- .arg(format!(
- "--ignore={}",
- util::root_path().join("std/node/tests").to_string_lossy()
- ))
- .arg(util::root_path().join("std"))
- .spawn()
- .unwrap()
- .wait()
- .unwrap();
- assert!(status.success());
-}
-
-#[test]
fn js_unit_tests_lint() {
let status = util::deno_cmd()
.arg("lint")
@@ -4888,7 +4852,7 @@ console.log("finish");
.arg("--unstable")
.arg("--output")
.arg(&exe)
- .arg("./std/examples/welcome.ts")
+ .arg("./test_util/std/examples/welcome.ts")
.stdout(std::process::Stdio::piped())
.spawn()
.unwrap()
diff --git a/cli/tests/test_runner_test.ts b/cli/tests/test_runner_test.ts
index a74c9a41a..08b69a0a6 100644
--- a/cli/tests/test_runner_test.ts
+++ b/cli/tests/test_runner_test.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-import { assert } from "../../std/testing/asserts.ts";
+import { assert } from "../../test_util/std/testing/asserts.ts";
Deno.test("fail1", function () {
assert(false, "fail1 assertion");
diff --git a/cli/tests/unit/blob_test.ts b/cli/tests/unit/blob_test.ts
index 210d05b3b..a3a8e06fd 100644
--- a/cli/tests/unit/blob_test.ts
+++ b/cli/tests/unit/blob_test.ts
@@ -1,7 +1,7 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
import { assert, assertEquals, unitTest } from "./test_util.ts";
-import { concat } from "../../../std/bytes/mod.ts";
-import { decode } from "../../../std/encoding/utf8.ts";
+import { concat } from "../../../test_util/std/bytes/mod.ts";
+import { decode } from "../../../test_util/std/encoding/utf8.ts";
unitTest(function blobString(): void {
const b1 = new Blob(["Hello World"]);
diff --git a/cli/tests/unit/console_test.ts b/cli/tests/unit/console_test.ts
index 64345be84..fc23b1d70 100644
--- a/cli/tests/unit/console_test.ts
+++ b/cli/tests/unit/console_test.ts
@@ -15,7 +15,7 @@ import {
assertThrows,
unitTest,
} from "./test_util.ts";
-import { stripColor } from "../../../std/fmt/colors.ts";
+import { stripColor } from "../../../test_util/std/fmt/colors.ts";
const customInspect = Deno.customInspect;
const {
diff --git a/cli/tests/unit/test_util.ts b/cli/tests/unit/test_util.ts
index 7dae86dfb..6c3c0c6a0 100644
--- a/cli/tests/unit/test_util.ts
+++ b/cli/tests/unit/test_util.ts
@@ -1,9 +1,12 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-import { assert, assertEquals } from "../../../std/testing/asserts.ts";
-import * as colors from "../../../std/fmt/colors.ts";
+import {
+ assert,
+ assertEquals,
+} from "../../../test_util/std/testing/asserts.ts";
+import * as colors from "../../../test_util/std/fmt/colors.ts";
export { colors };
-import { resolve } from "../../../std/path/mod.ts";
+import { resolve } from "../../../test_util/std/path/mod.ts";
export {
assert,
assertEquals,
@@ -15,10 +18,10 @@ export {
assertThrowsAsync,
fail,
unreachable,
-} from "../../../std/testing/asserts.ts";
-export { deferred } from "../../../std/async/deferred.ts";
-export { readLines } from "../../../std/io/bufio.ts";
-export { parse as parseArgs } from "../../../std/flags/mod.ts";
+} from "../../../test_util/std/testing/asserts.ts";
+export { deferred } from "../../../test_util/std/async/deferred.ts";
+export { readLines } from "../../../test_util/std/io/bufio.ts";
+export { parse as parseArgs } from "../../../test_util/std/flags/mod.ts";
export interface Permissions {
read: boolean;
diff --git a/cli/tests/unit/tls_test.ts b/cli/tests/unit/tls_test.ts
index 3a42ce4dd..ba1f067de 100644
--- a/cli/tests/unit/tls_test.ts
+++ b/cli/tests/unit/tls_test.ts
@@ -8,8 +8,8 @@ import {
deferred,
unitTest,
} from "./test_util.ts";
-import { BufReader, BufWriter } from "../../../std/io/bufio.ts";
-import { TextProtoReader } from "../../../std/textproto/mod.ts";
+import { BufReader, BufWriter } from "../../../test_util/std/io/bufio.ts";
+import { TextProtoReader } from "../../../test_util/std/textproto/mod.ts";
const encoder = new TextEncoder();
const decoder = new TextDecoder();
diff --git a/cli/tests/websocket_test.ts b/cli/tests/websocket_test.ts
index 177e5c362..b5f865943 100644
--- a/cli/tests/websocket_test.ts
+++ b/cli/tests/websocket_test.ts
@@ -4,8 +4,8 @@ import {
assertEquals,
assertThrows,
fail,
-} from "../../std/testing/asserts.ts";
-import { deferred } from "../../std/async/deferred.ts";
+} from "../../test_util/std/testing/asserts.ts";
+import { deferred } from "../../test_util/std/async/deferred.ts";
Deno.test("invalid scheme", () => {
assertThrows(() => new WebSocket("foo://localhost:4242"));
diff --git a/cli/tests/workers/parent_read_check_granular_worker.js b/cli/tests/workers/parent_read_check_granular_worker.js
index 1a7182e17..474b8a61b 100644
--- a/cli/tests/workers/parent_read_check_granular_worker.js
+++ b/cli/tests/workers/parent_read_check_granular_worker.js
@@ -1,4 +1,4 @@
-import { fromFileUrl } from "../../../std/path/mod.ts";
+import { fromFileUrl } from "../../../test_util/std/path/mod.ts";
const worker = new Worker(
new URL("./read_check_granular_worker.js", import.meta.url).href,
diff --git a/cli/tests/workers/read_check_granular_worker.js b/cli/tests/workers/read_check_granular_worker.js
index 4eddb7a75..d1a205391 100644
--- a/cli/tests/workers/read_check_granular_worker.js
+++ b/cli/tests/workers/read_check_granular_worker.js
@@ -1,4 +1,4 @@
-import { fromFileUrl } from "../../../std/path/mod.ts";
+import { fromFileUrl } from "../../../test_util/std/path/mod.ts";
onmessage = async ({ data }) => {
const { state } = await Deno.permissions.query({
diff --git a/cli/tests/workers_round_robin_bench.ts b/cli/tests/workers_round_robin_bench.ts
index 461e86f91..3dee290fe 100644
--- a/cli/tests/workers_round_robin_bench.ts
+++ b/cli/tests/workers_round_robin_bench.ts
@@ -5,7 +5,7 @@ const data = "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n";
const workerCount = 4;
const cmdsPerWorker = 400;
-import { Deferred, deferred } from "../../std/async/deferred.ts";
+import { Deferred, deferred } from "../../test_util/std/async/deferred.ts";
function handleAsyncMsgFromWorker(
promiseTable: Map<number, Deferred<string>>,
diff --git a/cli/tests/workers_test.ts b/cli/tests/workers_test.ts
index 1fe8b4538..383cad8a0 100644
--- a/cli/tests/workers_test.ts
+++ b/cli/tests/workers_test.ts
@@ -7,8 +7,8 @@ import {
assertEquals,
assertThrows,
fail,
-} from "../../std/testing/asserts.ts";
-import { deferred } from "../../std/async/deferred.ts";
+} from "../../test_util/std/testing/asserts.ts";
+import { deferred } from "../../test_util/std/async/deferred.ts";
Deno.test({
name: "worker terminate",
diff --git a/cli/tools/test_runner.rs b/cli/tools/test_runner.rs
index 172ca54ea..e91cad011 100644
--- a/cli/tools/test_runner.rs
+++ b/cli/tools/test_runner.rs
@@ -149,7 +149,12 @@ mod tests {
#[test]
fn supports_dirs() {
- let root = test_util::root_path().join("std").join("http");
+ // TODO(caspervonb) generate some fixtures in a temporary directory instead, there's no need
+ // for this to rely on external fixtures.
+ let root = test_util::root_path()
+ .join("test_util")
+ .join("std")
+ .join("http");
println!("root {:?}", root);
let mut matched_urls =
prepare_test_modules_urls(vec![".".to_string()], &root).unwrap();