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",
"target",
"tests/ffi/tests/test.js",
"test_util/std",
"tests/util/std",
"test_util/wpt",
"third_party",
"tools/node_compat/TODO.md",

View File

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

View File

@ -149,8 +149,8 @@ jobs:
fetch-depth: 5
submodules: false
if: '!(matrix.skip)'
- name: Clone submodule ./test_util/std
run: git submodule update --init --recursive --depth=1 -- ./test_util/std
- name: Clone submodule ./tests/util/std
run: git submodule update --init --recursive --depth=1 -- ./tests/util/std
if: '!(matrix.skip)'
- name: Clone submodule ./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"]
path = test_util/std
[submodule "tests/util/std"]
path = tests/util/std
url = https://github.com/denoland/deno_std
shallow = true
[submodule "test_util/wpt"]

View File

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

View File

@ -123,7 +123,7 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
"check",
"--reload",
"--unstable",
"test_util/std/http/file_server_test.ts",
"tests/util/std/http/file_server_test.ts",
],
None,
),
@ -134,7 +134,7 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
"--reload",
"--no-check",
"--unstable",
"test_util/std/http/file_server_test.ts",
"tests/util/std/http/file_server_test.ts",
],
None,
),
@ -143,7 +143,7 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
&[
"bundle",
"--unstable",
"test_util/std/http/file_server_test.ts",
"tests/util/std/http/file_server_test.ts",
],
None,
),
@ -153,7 +153,7 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
"bundle",
"--no-check",
"--unstable",
"test_util/std/http/file_server_test.ts",
"tests/util/std/http/file_server_test.ts",
],
None,
),
@ -306,7 +306,7 @@ fn get_binary_sizes(target_dir: &Path) -> Result<HashMap<String, i64>> {
}
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"),
];
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.
import { parse } from "../../../test_util/std/flags/mod.ts";
import { parse } from "../../../tests/util/std/flags/mod.ts";
const { port } = parse(Deno.args, {
number: ["port"],

View File

@ -118,7 +118,7 @@ pub fn jsr_registry_unset_url() -> String {
}
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 {

View File

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

View File

@ -1,6 +1,6 @@
{
"imports": {
"@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[] = [
"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[] = [
"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() {
for (let i = 1; i < Deno.args.length; 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({
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");

View File

@ -2,4 +2,4 @@
import {
assertNotEquals as _a,
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";
Deno.test("the truth", () => {

View File

@ -1,5 +1,5 @@
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", () => {
assertEquals(addNumbers(1, 2), 3);

View File

@ -1,5 +1,5 @@
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", () => {
assertEquals(addNumbers(1, 2), 3);

View File

@ -1,5 +1,5 @@
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", () => {
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";

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 [hostname, port] = addr.split(":");
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.
import { Server } from "../../../test_util/std/http/server.ts";
import { assertEquals } from "../../../test_util/std/assert/mod.ts";
import { Server } from "../../../tests/util/std/http/server.ts";
import { assertEquals } from "../../../tests/util/std/assert/mod.ts";
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 "./other.ts";

View File

@ -1,5 +1,5 @@
// 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";
const handler = (e: Event) => {

View File

@ -1,5 +1,5 @@
// 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";
assert(window.hasOwnProperty("onload"));

View File

@ -1,5 +1,5 @@
// 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) => {
assert(e.type === "beforeunload" ? e.cancelable : !e.cancelable);

View File

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

View File

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

View File

@ -1,6 +1,6 @@
import { assert, assertEquals } from "../../../test_util/std/assert/mod.ts";
import { BufReader } from "../../../test_util/std/io/buf_reader.ts";
import { BufWriter } from "../../../test_util/std/io/buf_writer.ts";
import { assert, assertEquals } from "../../../tests/util/std/assert/mod.ts";
import { BufReader } from "../../../tests/util/std/io/buf_reader.ts";
import { BufWriter } from "../../../tests/util/std/io/buf_writer.ts";
import { TextProtoReader } from "./textproto.ts";
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 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[] = [
"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[] = [
"read",

View File

@ -1,6 +1,6 @@
// https://github.com/denoland/deno/issues/13729
// 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 () => {
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) {
if (typeof self.Deno === "undefined") {

View File

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

View File

@ -5,12 +5,12 @@ import {
join,
resolve,
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";
export { dirname, fromFileUrl, join, resolve, toFileUrl };
export { existsSync, walk } from "../test_util/std/fs/mod.ts";
export { TextLineStream } from "../test_util/std/streams/text_line_stream.ts";
export { delay } from "../test_util/std/async/delay.ts";
export { existsSync, walk } from "../tests/util/std/fs/mod.ts";
export { TextLineStream } from "../tests/util/std/streams/text_line_stream.ts";
export { delay } from "../tests/util/std/async/delay.ts";
// [toolName] --version output
const versions = {

View File

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

View File

@ -1,7 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
/// 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";
export const {