diff options
author | Casper Beyer <caspervonb@pm.me> | 2021-02-02 19:05:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-02 12:05:46 +0100 |
commit | 6abf126c2a7a451cded8c6b5e6ddf1b69c84055d (patch) | |
tree | fd94c013a19fcb38954844085821ec1601c20e18 /cli/tests | |
parent | a2b5d44f1aa9d64f448a2a3cc2001272e2f60b98 (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/tests')
-rw-r--r-- | cli/tests/034_onload/imported.ts | 2 | ||||
-rw-r--r-- | cli/tests/034_onload/main.ts | 2 | ||||
-rw-r--r-- | cli/tests/034_onload/nest_imported.ts | 2 | ||||
-rw-r--r-- | cli/tests/045_proxy_client.ts | 4 | ||||
-rw-r--r-- | cli/tests/045_proxy_test.ts | 8 | ||||
-rw-r--r-- | cli/tests/045_proxy_test.ts.out | 6 | ||||
-rw-r--r-- | cli/tests/compiler_api_test.ts | 2 | ||||
-rw-r--r-- | cli/tests/hash.ts | 64 | ||||
-rw-r--r-- | cli/tests/integration_tests.rs | 38 | ||||
-rw-r--r-- | cli/tests/test_runner_test.ts | 2 | ||||
-rw-r--r-- | cli/tests/unit/blob_test.ts | 4 | ||||
-rw-r--r-- | cli/tests/unit/console_test.ts | 2 | ||||
-rw-r--r-- | cli/tests/unit/test_util.ts | 17 | ||||
-rw-r--r-- | cli/tests/unit/tls_test.ts | 4 | ||||
-rw-r--r-- | cli/tests/websocket_test.ts | 4 | ||||
-rw-r--r-- | cli/tests/workers/parent_read_check_granular_worker.js | 2 | ||||
-rw-r--r-- | cli/tests/workers/read_check_granular_worker.js | 2 | ||||
-rw-r--r-- | cli/tests/workers_round_robin_bench.ts | 2 | ||||
-rw-r--r-- | cli/tests/workers_test.ts | 4 |
19 files changed, 38 insertions, 133 deletions
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", |