0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-08 07:16:56 -05:00

chore: move test_util/std to tests/util/std (#22402)

Note: tests are not the only part of the codebase that uses `std`. Other
parts, like `tools/`, do too. So, it could be argued that this is a
little misleading. Either way, I'm doing this as discussed with
@mmastrac.
This commit is contained in:
Asher Gomez 2024-02-14 03:22:49 +11:00 committed by GitHub
parent a68eb3fcc3
commit 6be389ce29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
40 changed files with 61 additions and 55 deletions

View file

@ -46,7 +46,7 @@
"gh-pages", "gh-pages",
"target", "target",
"tests/ffi/tests/test.js", "tests/ffi/tests/test.js",
"test_util/std", "tests/util/std",
"test_util/wpt", "test_util/wpt",
"third_party", "third_party",
"tools/node_compat/TODO.md", "tools/node_compat/TODO.md",

View file

@ -445,7 +445,7 @@ const ci = {
}, },
steps: skipJobsIfPrAndMarkedSkip([ steps: skipJobsIfPrAndMarkedSkip([
...cloneRepoStep, ...cloneRepoStep,
submoduleStep("./test_util/std"), submoduleStep("./tests/util/std"),
{ {
...submoduleStep("./test_util/wpt"), ...submoduleStep("./test_util/wpt"),
if: "matrix.wpt", if: "matrix.wpt",

View file

@ -149,8 +149,8 @@ jobs:
fetch-depth: 5 fetch-depth: 5
submodules: false submodules: false
if: '!(matrix.skip)' if: '!(matrix.skip)'
- name: Clone submodule ./test_util/std - name: Clone submodule ./tests/util/std
run: git submodule update --init --recursive --depth=1 -- ./test_util/std run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
if: '!(matrix.skip)' if: '!(matrix.skip)'
- name: Clone submodule ./test_util/wpt - name: Clone submodule ./test_util/wpt
run: git submodule update --init --recursive --depth=1 -- ./test_util/wpt run: git submodule update --init --recursive --depth=1 -- ./test_util/wpt

4
.gitmodules vendored
View file

@ -1,5 +1,5 @@
[submodule "test_util/std"] [submodule "tests/util/std"]
path = test_util/std path = tests/util/std
url = https://github.com/denoland/deno_std url = https://github.com/denoland/deno_std
shallow = true shallow = true
[submodule "test_util/wpt"] [submodule "test_util/wpt"]

View file

@ -33,7 +33,7 @@ members = [
"tests/ffi", "tests/ffi",
"tests/napi", "tests/napi",
] ]
exclude = ["test_util/std/hash/_wasm"] exclude = ["tests/util/std/hash/_wasm"]
[workspace.package] [workspace.package]
authors = ["the Deno authors"] authors = ["the Deno authors"]

View file

@ -123,7 +123,7 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
"check", "check",
"--reload", "--reload",
"--unstable", "--unstable",
"test_util/std/http/file_server_test.ts", "tests/util/std/http/file_server_test.ts",
], ],
None, None,
), ),
@ -134,7 +134,7 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
"--reload", "--reload",
"--no-check", "--no-check",
"--unstable", "--unstable",
"test_util/std/http/file_server_test.ts", "tests/util/std/http/file_server_test.ts",
], ],
None, None,
), ),
@ -143,7 +143,7 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
&[ &[
"bundle", "bundle",
"--unstable", "--unstable",
"test_util/std/http/file_server_test.ts", "tests/util/std/http/file_server_test.ts",
], ],
None, None,
), ),
@ -153,7 +153,7 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
"bundle", "bundle",
"--no-check", "--no-check",
"--unstable", "--unstable",
"test_util/std/http/file_server_test.ts", "tests/util/std/http/file_server_test.ts",
], ],
None, None,
), ),
@ -306,7 +306,7 @@ fn get_binary_sizes(target_dir: &Path) -> Result<HashMap<String, i64>> {
} }
const BUNDLES: &[(&str, &str)] = &[ const BUNDLES: &[(&str, &str)] = &[
("file_server", "./test_util/std/http/file_server.ts"), ("file_server", "./tests/util/std/http/file_server.ts"),
("welcome", "./tests/testdata/welcome.ts"), ("welcome", "./tests/testdata/welcome.ts"),
]; ];
fn bundle_benchmark(deno_exe: &Path) -> Result<HashMap<String, i64>> { fn bundle_benchmark(deno_exe: &Path) -> Result<HashMap<String, i64>> {

View file

@ -1,5 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { parse } from "../../../test_util/std/flags/mod.ts"; import { parse } from "../../../tests/util/std/flags/mod.ts";
const { port } = parse(Deno.args, { const { port } = parse(Deno.args, {
number: ["port"], number: ["port"],

View file

@ -118,7 +118,7 @@ pub fn jsr_registry_unset_url() -> String {
} }
pub fn std_path() -> PathRef { pub fn std_path() -> PathRef {
root_path().join("test_util").join("std") root_path().join("tests").join("util").join("std")
} }
pub fn std_file_url() -> String { pub fn std_file_url() -> String {

View file

@ -1,6 +1,6 @@
{ {
"imports": { "imports": {
"@test_util/": "../../test_util/", "@test_util/": "../../test_util/",
"@std/": "../../test_util/std/" "@std/": "../util/std/"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"imports": { "imports": {
"@test_util/": "../../test_util/", "@test_util/": "../../test_util/",
"@std/": "../../test_util/std/" "@std/": "../util/std/"
} }
} }

View file

@ -1,4 +1,4 @@
import { assertEquals } from "../../../test_util/std/assert/mod.ts"; import { assertEquals } from "../../../tests/util/std/assert/mod.ts";
const permissions: Deno.PermissionName[] = [ const permissions: Deno.PermissionName[] = [
"read", "read",

View file

@ -1,4 +1,4 @@
import { unreachable } from "../../../test_util/std/assert/mod.ts"; import { unreachable } from "../../../tests/util/std/assert/mod.ts";
const permissions: Deno.PermissionName[] = [ const permissions: Deno.PermissionName[] = [
"read", "read",

View file

@ -1,4 +1,4 @@
import { copy } from "../../test_util/std/streams/copy.ts"; import { copy } from "../../tests/util/std/streams/copy.ts";
async function main() { async function main() {
for (let i = 1; i < Deno.args.length; i++) { for (let i = 1; i < Deno.args.length; i++) {
const filename = Deno.args[i]; const filename = Deno.args[i];

View file

@ -1,4 +1,4 @@
import { assertRejects } from "../../../test_util/std/assert/mod.ts"; import { assertRejects } from "../../../tests/util/std/assert/mod.ts";
const listener = Deno.listenTls({ const listener = Deno.listenTls({
port: Number(Deno.args[0]), port: Number(Deno.args[0]),

View file

@ -1,4 +1,4 @@
import { join } from "../../../../test_util/std/path/mod.ts"; import { join } from "../../../../tests/util/std/path/mod.ts";
console.log("Starting the main module"); console.log("Starting the main module");

View file

@ -2,4 +2,4 @@
import { import {
assertNotEquals as _a, assertNotEquals as _a,
assertStrictEquals as _b, assertStrictEquals as _b,
} from "../../../test_util/std/assert/mod.ts"; } from "../../../tests/util/std/assert/mod.ts";

View file

@ -1,4 +1,4 @@
import { assertSnapshot } from "../../../../test_util/std/testing/snapshot.ts"; import { assertSnapshot } from "../../../../tests/util/std/testing/snapshot.ts";
import { truth } from "./no_snaps_included.ts"; import { truth } from "./no_snaps_included.ts";
Deno.test("the truth", () => { Deno.test("the truth", () => {

View file

@ -1,5 +1,5 @@
import { addNumbers } from "./foo.ts"; import { addNumbers } from "./foo.ts";
import { assertEquals } from "../../../../test_util/std/assert/mod.ts"; import { assertEquals } from "../../../../tests/util/std/assert/mod.ts";
Deno.test("addNumbers works", () => { Deno.test("addNumbers works", () => {
assertEquals(addNumbers(1, 2), 3); assertEquals(addNumbers(1, 2), 3);

View file

@ -1,5 +1,5 @@
import { addNumbers } from "./foo.ts"; import { addNumbers } from "./foo.ts";
import { assertEquals } from "../../../../test_util/std/assert/mod.ts"; import { assertEquals } from "../../../../tests/util/std/assert/mod.ts";
Deno.test("addNumbers works", () => { Deno.test("addNumbers works", () => {
assertEquals(addNumbers(1, 2), 3); assertEquals(addNumbers(1, 2), 3);

View file

@ -1,5 +1,5 @@
import { addNumbers } from "./foo.ts"; import { addNumbers } from "./foo.ts";
import { assertEquals } from "../../../../test_util/std/assert/mod.ts"; import { assertEquals } from "../../../../tests/util/std/assert/mod.ts";
Deno.test("addNumbers works", () => { Deno.test("addNumbers works", () => {
assertEquals(addNumbers(1, 2), 3); assertEquals(addNumbers(1, 2), 3);

View file

@ -1,3 +1,3 @@
export { assertStrictEquals } from "../../../../test_util/std/assert/mod.ts"; export { assertStrictEquals } from "../../../../tests/util/std/assert/mod.ts";
export * from "./interface.ts"; export * from "./interface.ts";

View file

@ -1,4 +1,4 @@
import { copy } from "../../test_util/std/streams/copy.ts"; import { copy } from "../../tests/util/std/streams/copy.ts";
const addr = Deno.args[0] || "0.0.0.0:4544"; const addr = Deno.args[0] || "0.0.0.0:4544";
const [hostname, port] = addr.split(":"); const [hostname, port] = addr.split(":");
const listener = Deno.listen({ hostname, port: Number(port) }); const listener = Deno.listen({ hostname, port: Number(port) });

View file

@ -1,6 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { Server } from "../../../test_util/std/http/server.ts"; import { Server } from "../../../tests/util/std/http/server.ts";
import { assertEquals } from "../../../test_util/std/assert/mod.ts"; import { assertEquals } from "../../../tests/util/std/assert/mod.ts";
const addr = Deno.args[1] || "localhost:4555"; const addr = Deno.args[1] || "localhost:4555";

View file

@ -1,4 +1,4 @@
import { assertThrows } from "../../../../test_util/std/assert/mod.ts"; import { assertThrows } from "../../../../tests/util/std/assert/mod.ts";
import "http://localhost:4545/run/import_meta/other.ts"; import "http://localhost:4545/run/import_meta/other.ts";
import "./other.ts"; import "./other.ts";

View file

@ -1,5 +1,5 @@
// deno-lint-ignore-file no-window-prefix // deno-lint-ignore-file no-window-prefix
import { assert } from "../../../../test_util/std/assert/mod.ts"; import { assert } from "../../../../tests/util/std/assert/mod.ts";
import "./nest_imported.ts"; import "./nest_imported.ts";
const handler = (e: Event) => { const handler = (e: Event) => {

View file

@ -1,5 +1,5 @@
// deno-lint-ignore-file no-window-prefix no-prototype-builtins // deno-lint-ignore-file no-window-prefix no-prototype-builtins
import { assert } from "../../../../test_util/std/assert/mod.ts"; import { assert } from "../../../../tests/util/std/assert/mod.ts";
import "./imported.ts"; import "./imported.ts";
assert(window.hasOwnProperty("onload")); assert(window.hasOwnProperty("onload"));

View file

@ -1,5 +1,5 @@
// deno-lint-ignore-file no-window-prefix // deno-lint-ignore-file no-window-prefix
import { assert } from "../../../../test_util/std/assert/mod.ts"; import { assert } from "../../../../tests/util/std/assert/mod.ts";
const handler = (e: Event) => { const handler = (e: Event) => {
assert(e.type === "beforeunload" ? e.cancelable : !e.cancelable); assert(e.type === "beforeunload" ? e.cancelable : !e.cancelable);

View file

@ -17,8 +17,8 @@
import type { import type {
BufReader, BufReader,
ReadLineResult, ReadLineResult,
} from "../../../test_util/std/io/buf_reader.ts"; } from "../../../tests/util/std/io/buf_reader.ts";
import { concat } from "../../../test_util/std/bytes/concat.ts"; import { concat } from "../../../tests/util/std/bytes/concat.ts";
// Constants created for DRY // Constants created for DRY
const CHAR_SPACE: number = " ".charCodeAt(0); const CHAR_SPACE: number = " ".charCodeAt(0);

View file

@ -1,5 +1,5 @@
import { assert, assertEquals } from "../../../test_util/std/assert/mod.ts"; import { assert, assertEquals } from "../../../tests/util/std/assert/mod.ts";
import { BufReader, BufWriter } from "../../../test_util/std/io/mod.ts"; import { BufReader, BufWriter } from "../../../tests/util/std/io/mod.ts";
import { TextProtoReader } from "./textproto.ts"; import { TextProtoReader } from "./textproto.ts";
const encoder = new TextEncoder(); const encoder = new TextEncoder();

View file

@ -1,6 +1,6 @@
import { assert, assertEquals } from "../../../test_util/std/assert/mod.ts"; import { assert, assertEquals } from "../../../tests/util/std/assert/mod.ts";
import { BufReader } from "../../../test_util/std/io/buf_reader.ts"; import { BufReader } from "../../../tests/util/std/io/buf_reader.ts";
import { BufWriter } from "../../../test_util/std/io/buf_writer.ts"; import { BufWriter } from "../../../tests/util/std/io/buf_writer.ts";
import { TextProtoReader } from "./textproto.ts"; import { TextProtoReader } from "./textproto.ts";
const encoder = new TextEncoder(); const encoder = new TextEncoder();

View file

@ -1,4 +1,4 @@
import { assertEquals } from "../../../test_util/std/assert/mod.ts"; import { assertEquals } from "../../../tests/util/std/assert/mod.ts";
const errorDeferred = Promise.withResolvers<void>(); const errorDeferred = Promise.withResolvers<void>();
const closeDeferred = Promise.withResolvers<void>(); const closeDeferred = Promise.withResolvers<void>();

View file

@ -1,4 +1,4 @@
import { assertEquals } from "../../../test_util/std/assert/mod.ts"; import { assertEquals } from "../../../tests/util/std/assert/mod.ts";
const permissions: Deno.PermissionName[] = [ const permissions: Deno.PermissionName[] = [
"read", "read",

View file

@ -1,4 +1,4 @@
import { unreachable } from "../../../test_util/std/assert/mod.ts"; import { unreachable } from "../../../tests/util/std/assert/mod.ts";
const permissions: Deno.PermissionName[] = [ const permissions: Deno.PermissionName[] = [
"read", "read",

View file

@ -1,6 +1,6 @@
// https://github.com/denoland/deno/issues/13729 // https://github.com/denoland/deno/issues/13729
// https://github.com/denoland/deno/issues/13938 // https://github.com/denoland/deno/issues/13938
import { writeAll } from "../../../test_util/std/streams/write_all.ts"; import { writeAll } from "../../../tests/util/std/streams/write_all.ts";
Deno.test("test 1", { permissions: { write: true, read: true } }, async () => { Deno.test("test 1", { permissions: { write: true, read: true } }, async () => {
const tmpFile = await Deno.makeTempFile(); const tmpFile = await Deno.makeTempFile();

View file

@ -1,4 +1,4 @@
import { assert } from "../../../test_util/std/assert/mod.ts"; import { assert } from "../../../tests/util/std/assert/mod.ts";
onmessage = function (e) { onmessage = function (e) {
if (typeof self.Deno === "undefined") { if (typeof self.Deno === "undefined") {

View file

@ -1,7 +1,7 @@
{ {
"imports": { "imports": {
"@test_util/": "../../test_util/", "@test_util/": "../../test_util/",
"@std/": "../../test_util/std/" "@std/": "../../tests/util/std/"
}, },
"tasks": { "tasks": {
"setup": "deno run --allow-read --allow-write ./setup.ts", "setup": "deno run --allow-read --allow-write ./setup.ts",

View file

@ -5,12 +5,12 @@ import {
join, join,
resolve, resolve,
toFileUrl, toFileUrl,
} from "../test_util/std/path/mod.ts"; } from "../tests/util/std/path/mod.ts";
import { wait } from "https://deno.land/x/wait@0.1.13/mod.ts"; import { wait } from "https://deno.land/x/wait@0.1.13/mod.ts";
export { dirname, fromFileUrl, join, resolve, toFileUrl }; export { dirname, fromFileUrl, join, resolve, toFileUrl };
export { existsSync, walk } from "../test_util/std/fs/mod.ts"; export { existsSync, walk } from "../tests/util/std/fs/mod.ts";
export { TextLineStream } from "../test_util/std/streams/text_line_stream.ts"; export { TextLineStream } from "../tests/util/std/streams/text_line_stream.ts";
export { delay } from "../test_util/std/async/delay.ts"; export { delay } from "../tests/util/std/async/delay.ts";
// [toolName] --version output // [toolName] --version output
const versions = { const versions = {

View file

@ -32,9 +32,15 @@ import {
updateManifest, updateManifest,
wptreport, wptreport,
} from "./wpt/utils.ts"; } from "./wpt/utils.ts";
import { pooledMap } from "../test_util/std/async/pool.ts"; import { pooledMap } from "../tests/util/std/async/pool.ts";
import { blue, bold, green, red, yellow } from "../test_util/std/fmt/colors.ts"; import {
import { writeAll, writeAllSync } from "../test_util/std/streams/write_all.ts"; blue,
bold,
green,
red,
yellow,
} from "../tests/util/std/fmt/colors.ts";
import { writeAll, writeAllSync } from "../tests/util/std/streams/write_all.ts";
import { saveExpectation } from "./wpt/utils.ts"; import { saveExpectation } from "./wpt/utils.ts";
class TestFilter { class TestFilter {

View file

@ -1,7 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
/// FLAGS /// FLAGS
import { parse } from "../../test_util/std/flags/mod.ts"; import { parse } from "../../tests/util/std/flags/mod.ts";
import { join, resolve, ROOT_PATH } from "../util.js"; import { join, resolve, ROOT_PATH } from "../util.js";
export const { export const {