summaryrefslogtreecommitdiff
path: root/std/fs/utils_test.ts
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2020-05-09 13:34:47 +0100
committerGitHub <noreply@github.com>2020-05-09 08:34:47 -0400
commitf184332c09c851faac50f598d29ebe4426e05464 (patch)
tree2659aba63702537fcde1bb64ddeafea1e5863f3e /std/fs/utils_test.ts
parent2b02535028f868ea8dfc471c4921a237747ccd4a (diff)
BREAKING(std): reorganization (#5087)
* Prepend underscores to private modules * Remove collectUint8Arrays() It would be a misuse of Deno.iter()'s result. * Move std/_util/async.ts to std/async * Move std/util/sha*.ts to std/hash
Diffstat (limited to 'std/fs/utils_test.ts')
-rw-r--r--std/fs/utils_test.ts63
1 files changed, 0 insertions, 63 deletions
diff --git a/std/fs/utils_test.ts b/std/fs/utils_test.ts
deleted file mode 100644
index e104e3e7d..000000000
--- a/std/fs/utils_test.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright the Browserify authors. MIT License.
-
-import { assertEquals } from "../testing/asserts.ts";
-import * as path from "../path/mod.ts";
-import { isSubdir, getFileInfoType, PathType } from "./utils.ts";
-import { ensureFileSync } from "./ensure_file.ts";
-import { ensureDirSync } from "./ensure_dir.ts";
-
-const testdataDir = path.resolve("fs", "testdata");
-
-Deno.test("_isSubdir", function (): void {
- const pairs = [
- ["", "", false, path.posix.sep],
- ["/first/second", "/first", false, path.posix.sep],
- ["/first", "/first", false, path.posix.sep],
- ["/first", "/first/second", true, path.posix.sep],
- ["first", "first/second", true, path.posix.sep],
- ["../first", "../first/second", true, path.posix.sep],
- ["c:\\first", "c:\\first", false, path.win32.sep],
- ["c:\\first", "c:\\first\\second", true, path.win32.sep],
- ];
-
- pairs.forEach(function (p): void {
- const src = p[0] as string;
- const dest = p[1] as string;
- const expected = p[2] as boolean;
- const sep = p[3] as string;
- assertEquals(
- isSubdir(src, dest, sep),
- expected,
- `'${src}' should ${expected ? "" : "not"} be parent dir of '${dest}'`
- );
- });
-});
-
-Deno.test("_getFileInfoType", function (): void {
- const pairs = [
- [path.join(testdataDir, "file_type_1"), "file"],
- [path.join(testdataDir, "file_type_dir_1"), "dir"],
- ];
-
- pairs.forEach(function (p): void {
- const filePath = p[0] as string;
- const type = p[1] as PathType;
- switch (type) {
- case "file":
- ensureFileSync(filePath);
- break;
- case "dir":
- ensureDirSync(filePath);
- break;
- case "symlink":
- // TODO(axetroy): test symlink
- break;
- }
-
- const stat = Deno.statSync(filePath);
-
- Deno.removeSync(filePath, { recursive: true });
-
- assertEquals(getFileInfoType(stat), type);
- });
-});