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 /std/fs/_util_test.ts | |
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 'std/fs/_util_test.ts')
-rw-r--r-- | std/fs/_util_test.ts | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/std/fs/_util_test.ts b/std/fs/_util_test.ts deleted file mode 100644 index 9a24caaf0..000000000 --- a/std/fs/_util_test.ts +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright the Browserify authors. MIT License. - -import { assertEquals } from "../testing/asserts.ts"; -import * as path from "../path/mod.ts"; -import { getFileInfoType, isSubdir, PathType } from "./_util.ts"; -import { ensureFileSync } from "./ensure_file.ts"; -import { ensureDirSync } from "./ensure_dir.ts"; - -const moduleDir = path.dirname(path.fromFileUrl(import.meta.url)); -const testdataDir = path.resolve(moduleDir, "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); - }); -}); |