summaryrefslogtreecommitdiff
path: root/fs/path
diff options
context:
space:
mode:
authorVincent LE GOFF <g_n_s@hotmail.fr>2019-03-06 22:39:50 +0100
committerRyan Dahl <ry@tinyclouds.org>2019-03-06 16:39:50 -0500
commite36edfdb3fd4709358a5f499f13cfe3d53c2b4f7 (patch)
tree1baef3f876a5e75288c3ec9056cdb93dd6b5787f /fs/path
parentd29957ad17956016c35a04f5f1f98565e58e8a2e (diff)
Testing refactor (denoland/deno_std#240)
Original: https://github.com/denoland/deno_std/commit/e1d5c00279132aa639030c6c6d9b4e308bd4775e
Diffstat (limited to 'fs/path')
-rw-r--r--fs/path/basename_test.ts112
-rw-r--r--fs/path/dirname_test.ts85
-rw-r--r--fs/path/extname_test.ts41
-rw-r--r--fs/path/isabsolute_test.ts47
-rw-r--r--fs/path/join_test.ts9
-rw-r--r--fs/path/parse_format_test.ts29
-rw-r--r--fs/path/relative_test.ts7
-rw-r--r--fs/path/resolve_test.ts7
-rw-r--r--fs/path/zero_length_strings_test.ts35
9 files changed, 189 insertions, 183 deletions
diff --git a/fs/path/basename_test.ts b/fs/path/basename_test.ts
index ffe9e051c..b4b6f1303 100644
--- a/fs/path/basename_test.ts
+++ b/fs/path/basename_test.ts
@@ -1,75 +1,73 @@
// Copyright the Browserify authors. MIT License.
// Ported from https://github.com/browserify/path-browserify/
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import * as path from "./mod.ts";
test(function basename() {
- assertEqual(path.basename(".js", ".js"), "");
- assertEqual(path.basename(""), "");
- assertEqual(path.basename("/dir/basename.ext"), "basename.ext");
- assertEqual(path.basename("/basename.ext"), "basename.ext");
- assertEqual(path.basename("basename.ext"), "basename.ext");
- assertEqual(path.basename("basename.ext/"), "basename.ext");
- assertEqual(path.basename("basename.ext//"), "basename.ext");
- assertEqual(path.basename("aaa/bbb", "/bbb"), "bbb");
- assertEqual(path.basename("aaa/bbb", "a/bbb"), "bbb");
- assertEqual(path.basename("aaa/bbb", "bbb"), "bbb");
- assertEqual(path.basename("aaa/bbb//", "bbb"), "bbb");
- assertEqual(path.basename("aaa/bbb", "bb"), "b");
- assertEqual(path.basename("aaa/bbb", "b"), "bb");
- assertEqual(path.basename("/aaa/bbb", "/bbb"), "bbb");
- assertEqual(path.basename("/aaa/bbb", "a/bbb"), "bbb");
- assertEqual(path.basename("/aaa/bbb", "bbb"), "bbb");
- assertEqual(path.basename("/aaa/bbb//", "bbb"), "bbb");
- assertEqual(path.basename("/aaa/bbb", "bb"), "b");
- assertEqual(path.basename("/aaa/bbb", "b"), "bb");
- assertEqual(path.basename("/aaa/bbb"), "bbb");
- assertEqual(path.basename("/aaa/"), "aaa");
- assertEqual(path.basename("/aaa/b"), "b");
- assertEqual(path.basename("/a/b"), "b");
- assertEqual(path.basename("//a"), "a");
+ assertEq(path.basename(".js", ".js"), "");
+ assertEq(path.basename(""), "");
+ assertEq(path.basename("/dir/basename.ext"), "basename.ext");
+ assertEq(path.basename("/basename.ext"), "basename.ext");
+ assertEq(path.basename("basename.ext"), "basename.ext");
+ assertEq(path.basename("basename.ext/"), "basename.ext");
+ assertEq(path.basename("basename.ext//"), "basename.ext");
+ assertEq(path.basename("aaa/bbb", "/bbb"), "bbb");
+ assertEq(path.basename("aaa/bbb", "a/bbb"), "bbb");
+ assertEq(path.basename("aaa/bbb", "bbb"), "bbb");
+ assertEq(path.basename("aaa/bbb//", "bbb"), "bbb");
+ assertEq(path.basename("aaa/bbb", "bb"), "b");
+ assertEq(path.basename("aaa/bbb", "b"), "bb");
+ assertEq(path.basename("/aaa/bbb", "/bbb"), "bbb");
+ assertEq(path.basename("/aaa/bbb", "a/bbb"), "bbb");
+ assertEq(path.basename("/aaa/bbb", "bbb"), "bbb");
+ assertEq(path.basename("/aaa/bbb//", "bbb"), "bbb");
+ assertEq(path.basename("/aaa/bbb", "bb"), "b");
+ assertEq(path.basename("/aaa/bbb", "b"), "bb");
+ assertEq(path.basename("/aaa/bbb"), "bbb");
+ assertEq(path.basename("/aaa/"), "aaa");
+ assertEq(path.basename("/aaa/b"), "b");
+ assertEq(path.basename("/a/b"), "b");
+ assertEq(path.basename("//a"), "a");
// On unix a backslash is just treated as any other character.
- assertEqual(
- path.posix.basename("\\dir\\basename.ext"),
- "\\dir\\basename.ext"
- );
- assertEqual(path.posix.basename("\\basename.ext"), "\\basename.ext");
- assertEqual(path.posix.basename("basename.ext"), "basename.ext");
- assertEqual(path.posix.basename("basename.ext\\"), "basename.ext\\");
- assertEqual(path.posix.basename("basename.ext\\\\"), "basename.ext\\\\");
- assertEqual(path.posix.basename("foo"), "foo");
+ assertEq(path.posix.basename("\\dir\\basename.ext"), "\\dir\\basename.ext");
+ assertEq(path.posix.basename("\\basename.ext"), "\\basename.ext");
+ assertEq(path.posix.basename("basename.ext"), "basename.ext");
+ assertEq(path.posix.basename("basename.ext\\"), "basename.ext\\");
+ assertEq(path.posix.basename("basename.ext\\\\"), "basename.ext\\\\");
+ assertEq(path.posix.basename("foo"), "foo");
// POSIX filenames may include control characters
const controlCharFilename = "Icon" + String.fromCharCode(13);
- assertEqual(
+ assertEq(
path.posix.basename("/a/b/" + controlCharFilename),
controlCharFilename
);
});
test(function basenameWin32() {
- assertEqual(path.win32.basename("\\dir\\basename.ext"), "basename.ext");
- assertEqual(path.win32.basename("\\basename.ext"), "basename.ext");
- assertEqual(path.win32.basename("basename.ext"), "basename.ext");
- assertEqual(path.win32.basename("basename.ext\\"), "basename.ext");
- assertEqual(path.win32.basename("basename.ext\\\\"), "basename.ext");
- assertEqual(path.win32.basename("foo"), "foo");
- assertEqual(path.win32.basename("aaa\\bbb", "\\bbb"), "bbb");
- assertEqual(path.win32.basename("aaa\\bbb", "a\\bbb"), "bbb");
- assertEqual(path.win32.basename("aaa\\bbb", "bbb"), "bbb");
- assertEqual(path.win32.basename("aaa\\bbb\\\\\\\\", "bbb"), "bbb");
- assertEqual(path.win32.basename("aaa\\bbb", "bb"), "b");
- assertEqual(path.win32.basename("aaa\\bbb", "b"), "bb");
- assertEqual(path.win32.basename("C:"), "");
- assertEqual(path.win32.basename("C:."), ".");
- assertEqual(path.win32.basename("C:\\"), "");
- assertEqual(path.win32.basename("C:\\dir\\base.ext"), "base.ext");
- assertEqual(path.win32.basename("C:\\basename.ext"), "basename.ext");
- assertEqual(path.win32.basename("C:basename.ext"), "basename.ext");
- assertEqual(path.win32.basename("C:basename.ext\\"), "basename.ext");
- assertEqual(path.win32.basename("C:basename.ext\\\\"), "basename.ext");
- assertEqual(path.win32.basename("C:foo"), "foo");
- assertEqual(path.win32.basename("file:stream"), "file:stream");
+ assertEq(path.win32.basename("\\dir\\basename.ext"), "basename.ext");
+ assertEq(path.win32.basename("\\basename.ext"), "basename.ext");
+ assertEq(path.win32.basename("basename.ext"), "basename.ext");
+ assertEq(path.win32.basename("basename.ext\\"), "basename.ext");
+ assertEq(path.win32.basename("basename.ext\\\\"), "basename.ext");
+ assertEq(path.win32.basename("foo"), "foo");
+ assertEq(path.win32.basename("aaa\\bbb", "\\bbb"), "bbb");
+ assertEq(path.win32.basename("aaa\\bbb", "a\\bbb"), "bbb");
+ assertEq(path.win32.basename("aaa\\bbb", "bbb"), "bbb");
+ assertEq(path.win32.basename("aaa\\bbb\\\\\\\\", "bbb"), "bbb");
+ assertEq(path.win32.basename("aaa\\bbb", "bb"), "b");
+ assertEq(path.win32.basename("aaa\\bbb", "b"), "bb");
+ assertEq(path.win32.basename("C:"), "");
+ assertEq(path.win32.basename("C:."), ".");
+ assertEq(path.win32.basename("C:\\"), "");
+ assertEq(path.win32.basename("C:\\dir\\base.ext"), "base.ext");
+ assertEq(path.win32.basename("C:\\basename.ext"), "basename.ext");
+ assertEq(path.win32.basename("C:basename.ext"), "basename.ext");
+ assertEq(path.win32.basename("C:basename.ext\\"), "basename.ext");
+ assertEq(path.win32.basename("C:basename.ext\\\\"), "basename.ext");
+ assertEq(path.win32.basename("C:foo"), "foo");
+ assertEq(path.win32.basename("file:stream"), "file:stream");
});
diff --git a/fs/path/dirname_test.ts b/fs/path/dirname_test.ts
index 5613d6d2c..cf52f067d 100644
--- a/fs/path/dirname_test.ts
+++ b/fs/path/dirname_test.ts
@@ -1,61 +1,62 @@
// Copyright the Browserify authors. MIT License.
// Ported from https://github.com/browserify/path-browserify/
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import * as path from "./mod.ts";
test(function dirname() {
- assertEqual(path.posix.dirname("/a/b/"), "/a");
- assertEqual(path.posix.dirname("/a/b"), "/a");
- assertEqual(path.posix.dirname("/a"), "/");
- assertEqual(path.posix.dirname(""), ".");
- assertEqual(path.posix.dirname("/"), "/");
- assertEqual(path.posix.dirname("////"), "/");
- assertEqual(path.posix.dirname("//a"), "//");
- assertEqual(path.posix.dirname("foo"), ".");
+ assertEq(path.posix.dirname("/a/b/"), "/a");
+ assertEq(path.posix.dirname("/a/b"), "/a");
+ assertEq(path.posix.dirname("/a"), "/");
+ assertEq(path.posix.dirname(""), ".");
+ assertEq(path.posix.dirname("/"), "/");
+ assertEq(path.posix.dirname("////"), "/");
+ assertEq(path.posix.dirname("//a"), "//");
+ assertEq(path.posix.dirname("foo"), ".");
});
test(function dirnameWin32() {
- assertEqual(path.win32.dirname("c:\\"), "c:\\");
- assertEqual(path.win32.dirname("c:\\foo"), "c:\\");
- assertEqual(path.win32.dirname("c:\\foo\\"), "c:\\");
- assertEqual(path.win32.dirname("c:\\foo\\bar"), "c:\\foo");
- assertEqual(path.win32.dirname("c:\\foo\\bar\\"), "c:\\foo");
- assertEqual(path.win32.dirname("c:\\foo\\bar\\baz"), "c:\\foo\\bar");
- assertEqual(path.win32.dirname("\\"), "\\");
- assertEqual(path.win32.dirname("\\foo"), "\\");
- assertEqual(path.win32.dirname("\\foo\\"), "\\");
- assertEqual(path.win32.dirname("\\foo\\bar"), "\\foo");
- assertEqual(path.win32.dirname("\\foo\\bar\\"), "\\foo");
- assertEqual(path.win32.dirname("\\foo\\bar\\baz"), "\\foo\\bar");
- assertEqual(path.win32.dirname("c:"), "c:");
- assertEqual(path.win32.dirname("c:foo"), "c:");
- assertEqual(path.win32.dirname("c:foo\\"), "c:");
- assertEqual(path.win32.dirname("c:foo\\bar"), "c:foo");
- assertEqual(path.win32.dirname("c:foo\\bar\\"), "c:foo");
- assertEqual(path.win32.dirname("c:foo\\bar\\baz"), "c:foo\\bar");
- assertEqual(path.win32.dirname("file:stream"), ".");
- assertEqual(path.win32.dirname("dir\\file:stream"), "dir");
- assertEqual(path.win32.dirname("\\\\unc\\share"), "\\\\unc\\share");
- assertEqual(path.win32.dirname("\\\\unc\\share\\foo"), "\\\\unc\\share\\");
- assertEqual(path.win32.dirname("\\\\unc\\share\\foo\\"), "\\\\unc\\share\\");
- assertEqual(
+ assertEq(path.win32.dirname("c:\\"), "c:\\");
+ assertEq(path.win32.dirname("c:\\foo"), "c:\\");
+ assertEq(path.win32.dirname("c:\\foo\\"), "c:\\");
+ assertEq(path.win32.dirname("c:\\foo\\bar"), "c:\\foo");
+ assertEq(path.win32.dirname("c:\\foo\\bar\\"), "c:\\foo");
+ assertEq(path.win32.dirname("c:\\foo\\bar\\baz"), "c:\\foo\\bar");
+ assertEq(path.win32.dirname("\\"), "\\");
+ assertEq(path.win32.dirname("\\foo"), "\\");
+ assertEq(path.win32.dirname("\\foo\\"), "\\");
+ assertEq(path.win32.dirname("\\foo\\bar"), "\\foo");
+ assertEq(path.win32.dirname("\\foo\\bar\\"), "\\foo");
+ assertEq(path.win32.dirname("\\foo\\bar\\baz"), "\\foo\\bar");
+ assertEq(path.win32.dirname("c:"), "c:");
+ assertEq(path.win32.dirname("c:foo"), "c:");
+ assertEq(path.win32.dirname("c:foo\\"), "c:");
+ assertEq(path.win32.dirname("c:foo\\bar"), "c:foo");
+ assertEq(path.win32.dirname("c:foo\\bar\\"), "c:foo");
+ assertEq(path.win32.dirname("c:foo\\bar\\baz"), "c:foo\\bar");
+ assertEq(path.win32.dirname("file:stream"), ".");
+ assertEq(path.win32.dirname("dir\\file:stream"), "dir");
+ assertEq(path.win32.dirname("\\\\unc\\share"), "\\\\unc\\share");
+ assertEq(path.win32.dirname("\\\\unc\\share\\foo"), "\\\\unc\\share\\");
+ assertEq(path.win32.dirname("\\\\unc\\share\\foo\\"), "\\\\unc\\share\\");
+ assertEq(
path.win32.dirname("\\\\unc\\share\\foo\\bar"),
"\\\\unc\\share\\foo"
);
- assertEqual(
+ assertEq(
path.win32.dirname("\\\\unc\\share\\foo\\bar\\"),
"\\\\unc\\share\\foo"
);
- assertEqual(
+ assertEq(
path.win32.dirname("\\\\unc\\share\\foo\\bar\\baz"),
"\\\\unc\\share\\foo\\bar"
);
- assertEqual(path.win32.dirname("/a/b/"), "/a");
- assertEqual(path.win32.dirname("/a/b"), "/a");
- assertEqual(path.win32.dirname("/a"), "/");
- assertEqual(path.win32.dirname(""), ".");
- assertEqual(path.win32.dirname("/"), "/");
- assertEqual(path.win32.dirname("////"), "/");
- assertEqual(path.win32.dirname("foo"), ".");
+ assertEq(path.win32.dirname("/a/b/"), "/a");
+ assertEq(path.win32.dirname("/a/b"), "/a");
+ assertEq(path.win32.dirname("/a"), "/");
+ assertEq(path.win32.dirname(""), ".");
+ assertEq(path.win32.dirname("/"), "/");
+ assertEq(path.win32.dirname("////"), "/");
+ assertEq(path.win32.dirname("foo"), ".");
});
diff --git a/fs/path/extname_test.ts b/fs/path/extname_test.ts
index 63d473d34..08f780e7d 100644
--- a/fs/path/extname_test.ts
+++ b/fs/path/extname_test.ts
@@ -1,7 +1,8 @@
// Copyright the Browserify authors. MIT License.
// Ported from https://github.com/browserify/path-browserify/
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import * as path from "./mod.ts";
const slashRE = /\//g;
@@ -55,35 +56,35 @@ test(function extname() {
pairs.forEach(function(p) {
const input = p[0];
const expected = p[1];
- assertEqual(expected, path.posix.extname(input));
+ assertEq(expected, path.posix.extname(input));
});
// On *nix, backslash is a valid name component like any other character.
- assertEqual(path.posix.extname(".\\"), "");
- assertEqual(path.posix.extname("..\\"), ".\\");
- assertEqual(path.posix.extname("file.ext\\"), ".ext\\");
- assertEqual(path.posix.extname("file.ext\\\\"), ".ext\\\\");
- assertEqual(path.posix.extname("file\\"), "");
- assertEqual(path.posix.extname("file\\\\"), "");
- assertEqual(path.posix.extname("file.\\"), ".\\");
- assertEqual(path.posix.extname("file.\\\\"), ".\\\\");
+ assertEq(path.posix.extname(".\\"), "");
+ assertEq(path.posix.extname("..\\"), ".\\");
+ assertEq(path.posix.extname("file.ext\\"), ".ext\\");
+ assertEq(path.posix.extname("file.ext\\\\"), ".ext\\\\");
+ assertEq(path.posix.extname("file\\"), "");
+ assertEq(path.posix.extname("file\\\\"), "");
+ assertEq(path.posix.extname("file.\\"), ".\\");
+ assertEq(path.posix.extname("file.\\\\"), ".\\\\");
});
test(function extnameWin32() {
pairs.forEach(function(p) {
const input = p[0].replace(slashRE, "\\");
const expected = p[1];
- assertEqual(expected, path.win32.extname(input));
- assertEqual(expected, path.win32.extname("C:" + input));
+ assertEq(expected, path.win32.extname(input));
+ assertEq(expected, path.win32.extname("C:" + input));
});
// On Windows, backslash is a path separator.
- assertEqual(path.win32.extname(".\\"), "");
- assertEqual(path.win32.extname("..\\"), "");
- assertEqual(path.win32.extname("file.ext\\"), ".ext");
- assertEqual(path.win32.extname("file.ext\\\\"), ".ext");
- assertEqual(path.win32.extname("file\\"), "");
- assertEqual(path.win32.extname("file\\\\"), "");
- assertEqual(path.win32.extname("file.\\"), ".");
- assertEqual(path.win32.extname("file.\\\\"), ".");
+ assertEq(path.win32.extname(".\\"), "");
+ assertEq(path.win32.extname("..\\"), "");
+ assertEq(path.win32.extname("file.ext\\"), ".ext");
+ assertEq(path.win32.extname("file.ext\\\\"), ".ext");
+ assertEq(path.win32.extname("file\\"), "");
+ assertEq(path.win32.extname("file\\\\"), "");
+ assertEq(path.win32.extname("file.\\"), ".");
+ assertEq(path.win32.extname("file.\\\\"), ".");
});
diff --git a/fs/path/isabsolute_test.ts b/fs/path/isabsolute_test.ts
index 9591b8045..7b262e354 100644
--- a/fs/path/isabsolute_test.ts
+++ b/fs/path/isabsolute_test.ts
@@ -1,33 +1,34 @@
// Copyright the Browserify authors. MIT License.
// Ported from https://github.com/browserify/path-browserify/
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import * as path from "./mod.ts";
test(function isAbsolute() {
- assertEqual(path.posix.isAbsolute("/home/foo"), true);
- assertEqual(path.posix.isAbsolute("/home/foo/.."), true);
- assertEqual(path.posix.isAbsolute("bar/"), false);
- assertEqual(path.posix.isAbsolute("./baz"), false);
+ assertEq(path.posix.isAbsolute("/home/foo"), true);
+ assertEq(path.posix.isAbsolute("/home/foo/.."), true);
+ assertEq(path.posix.isAbsolute("bar/"), false);
+ assertEq(path.posix.isAbsolute("./baz"), false);
});
test(function isAbsoluteWin32() {
- assertEqual(path.win32.isAbsolute("/"), true);
- assertEqual(path.win32.isAbsolute("//"), true);
- assertEqual(path.win32.isAbsolute("//server"), true);
- assertEqual(path.win32.isAbsolute("//server/file"), true);
- assertEqual(path.win32.isAbsolute("\\\\server\\file"), true);
- assertEqual(path.win32.isAbsolute("\\\\server"), true);
- assertEqual(path.win32.isAbsolute("\\\\"), true);
- assertEqual(path.win32.isAbsolute("c"), false);
- assertEqual(path.win32.isAbsolute("c:"), false);
- assertEqual(path.win32.isAbsolute("c:\\"), true);
- assertEqual(path.win32.isAbsolute("c:/"), true);
- assertEqual(path.win32.isAbsolute("c://"), true);
- assertEqual(path.win32.isAbsolute("C:/Users/"), true);
- assertEqual(path.win32.isAbsolute("C:\\Users\\"), true);
- assertEqual(path.win32.isAbsolute("C:cwd/another"), false);
- assertEqual(path.win32.isAbsolute("C:cwd\\another"), false);
- assertEqual(path.win32.isAbsolute("directory/directory"), false);
- assertEqual(path.win32.isAbsolute("directory\\directory"), false);
+ assertEq(path.win32.isAbsolute("/"), true);
+ assertEq(path.win32.isAbsolute("//"), true);
+ assertEq(path.win32.isAbsolute("//server"), true);
+ assertEq(path.win32.isAbsolute("//server/file"), true);
+ assertEq(path.win32.isAbsolute("\\\\server\\file"), true);
+ assertEq(path.win32.isAbsolute("\\\\server"), true);
+ assertEq(path.win32.isAbsolute("\\\\"), true);
+ assertEq(path.win32.isAbsolute("c"), false);
+ assertEq(path.win32.isAbsolute("c:"), false);
+ assertEq(path.win32.isAbsolute("c:\\"), true);
+ assertEq(path.win32.isAbsolute("c:/"), true);
+ assertEq(path.win32.isAbsolute("c://"), true);
+ assertEq(path.win32.isAbsolute("C:/Users/"), true);
+ assertEq(path.win32.isAbsolute("C:\\Users\\"), true);
+ assertEq(path.win32.isAbsolute("C:cwd/another"), false);
+ assertEq(path.win32.isAbsolute("C:cwd\\another"), false);
+ assertEq(path.win32.isAbsolute("directory/directory"), false);
+ assertEq(path.win32.isAbsolute("directory\\directory"), false);
});
diff --git a/fs/path/join_test.ts b/fs/path/join_test.ts
index 2051dbdaa..acf5a8096 100644
--- a/fs/path/join_test.ts
+++ b/fs/path/join_test.ts
@@ -1,4 +1,5 @@
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import * as path from "./mod.ts";
const backslashRE = /\\/g;
@@ -108,17 +109,17 @@ const windowsJoinTests = [
test(function join() {
joinTests.forEach(function(p) {
const actual = path.posix.join.apply(null, p[0]);
- assertEqual(actual, p[1]);
+ assertEq(actual, p[1]);
});
});
test(function joinWin32() {
joinTests.forEach(function(p) {
const actual = path.win32.join.apply(null, p[0]).replace(backslashRE, "/");
- assertEqual(actual, p[1]);
+ assertEq(actual, p[1]);
});
windowsJoinTests.forEach(function(p) {
const actual = path.win32.join.apply(null, p[0]);
- assertEqual(actual, p[1]);
+ assertEq(actual, p[1]);
});
});
diff --git a/fs/path/parse_format_test.ts b/fs/path/parse_format_test.ts
index 8b429ce24..3bf3c462b 100644
--- a/fs/path/parse_format_test.ts
+++ b/fs/path/parse_format_test.ts
@@ -1,7 +1,8 @@
// Copyright the Browserify authors. MIT License.
// Ported from https://github.com/browserify/path-browserify/
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import * as path from "./mod.ts";
const winPaths = [
@@ -130,15 +131,15 @@ function checkParseFormat(path, paths) {
paths.forEach(function(p) {
const element = p[0];
const output = path.parse(element);
- assertEqual(typeof output.root, "string");
- assertEqual(typeof output.dir, "string");
- assertEqual(typeof output.base, "string");
- assertEqual(typeof output.ext, "string");
- assertEqual(typeof output.name, "string");
- assertEqual(path.format(output), element);
- assertEqual(output.rooroot, undefined);
- assertEqual(output.dir, output.dir ? path.dirname(element) : "");
- assertEqual(output.base, path.basename(element));
+ assertEq(typeof output.root, "string");
+ assertEq(typeof output.dir, "string");
+ assertEq(typeof output.base, "string");
+ assertEq(typeof output.ext, "string");
+ assertEq(typeof output.name, "string");
+ assertEq(path.format(output), element);
+ assertEq(output.rooroot, undefined);
+ assertEq(output.dir, output.dir ? path.dirname(element) : "");
+ assertEq(output.base, path.basename(element));
});
}
@@ -148,14 +149,14 @@ function checkSpecialCaseParseFormat(path, testCases) {
const expect = testCase[1];
const output = path.parse(element);
Object.keys(expect).forEach(function(key) {
- assertEqual(output[key], expect[key]);
+ assertEq(output[key], expect[key]);
});
});
}
function checkFormat(path, testCases) {
testCases.forEach(function(testCase) {
- assertEqual(path.format(testCase[0]), testCase[1]);
+ assertEq(path.format(testCase[0]), testCase[1]);
});
}
@@ -163,7 +164,7 @@ test(function parseTrailingWin32() {
windowsTrailingTests.forEach(function(p) {
const actual = path.win32.parse(p[0] as string);
const expected = p[1];
- assertEqual(actual, expected);
+ assertEq(actual, expected);
});
});
@@ -171,6 +172,6 @@ test(function parseTrailing() {
posixTrailingTests.forEach(function(p) {
const actual = path.posix.parse(p[0] as string);
const expected = p[1];
- assertEqual(actual, expected);
+ assertEq(actual, expected);
});
});
diff --git a/fs/path/relative_test.ts b/fs/path/relative_test.ts
index 87e308b43..7a76c4578 100644
--- a/fs/path/relative_test.ts
+++ b/fs/path/relative_test.ts
@@ -1,7 +1,8 @@
// Copyright the Browserify authors. MIT License.
// Ported from https://github.com/browserify/path-browserify/
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import * as path from "./mod.ts";
const relativeTests = {
@@ -59,7 +60,7 @@ test(function relative() {
relativeTests.posix.forEach(function(p) {
const expected = p[2];
const actual = path.posix.relative(p[0], p[1]);
- assertEqual(actual, expected);
+ assertEq(actual, expected);
});
});
@@ -67,6 +68,6 @@ test(function relativeWin32() {
relativeTests.win32.forEach(function(p) {
const expected = p[2];
const actual = path.win32.relative(p[0], p[1]);
- assertEqual(actual, expected);
+ assertEq(actual, expected);
});
});
diff --git a/fs/path/resolve_test.ts b/fs/path/resolve_test.ts
index 2259dd025..7243dc030 100644
--- a/fs/path/resolve_test.ts
+++ b/fs/path/resolve_test.ts
@@ -2,7 +2,8 @@
// Ported from https://github.com/browserify/path-browserify/
const { cwd } = Deno;
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import * as path from "./mod.ts";
const windowsTests =
@@ -37,13 +38,13 @@ const posixTests =
test(function resolve() {
posixTests.forEach(function(p) {
const actual = path.posix.resolve.apply(null, p[0]);
- assertEqual(actual, p[1]);
+ assertEq(actual, p[1]);
});
});
test(function resolveWin32() {
windowsTests.forEach(function(p) {
const actual = path.win32.resolve.apply(null, p[0]);
- assertEqual(actual, p[1]);
+ assertEq(actual, p[1]);
});
});
diff --git a/fs/path/zero_length_strings_test.ts b/fs/path/zero_length_strings_test.ts
index c769c9a79..469a0a7c0 100644
--- a/fs/path/zero_length_strings_test.ts
+++ b/fs/path/zero_length_strings_test.ts
@@ -2,7 +2,8 @@
// Ported from https://github.com/browserify/path-browserify/
const { cwd } = Deno;
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import * as path from "./mod.ts";
const pwd = cwd();
@@ -10,37 +11,37 @@ const pwd = cwd();
test(function joinZeroLength() {
// join will internally ignore all the zero-length strings and it will return
// '.' if the joined string is a zero-length string.
- assertEqual(path.posix.join(""), ".");
- assertEqual(path.posix.join("", ""), ".");
- if (path.win32) assertEqual(path.win32.join(""), ".");
- if (path.win32) assertEqual(path.win32.join("", ""), ".");
- assertEqual(path.join(pwd), pwd);
- assertEqual(path.join(pwd, ""), pwd);
+ assertEq(path.posix.join(""), ".");
+ assertEq(path.posix.join("", ""), ".");
+ if (path.win32) assertEq(path.win32.join(""), ".");
+ if (path.win32) assertEq(path.win32.join("", ""), ".");
+ assertEq(path.join(pwd), pwd);
+ assertEq(path.join(pwd, ""), pwd);
});
test(function normalizeZeroLength() {
// normalize will return '.' if the input is a zero-length string
- assertEqual(path.posix.normalize(""), ".");
- if (path.win32) assertEqual(path.win32.normalize(""), ".");
- assertEqual(path.normalize(pwd), pwd);
+ assertEq(path.posix.normalize(""), ".");
+ if (path.win32) assertEq(path.win32.normalize(""), ".");
+ assertEq(path.normalize(pwd), pwd);
});
test(function isAbsoluteZeroLength() {
// Since '' is not a valid path in any of the common environments, return false
- assertEqual(path.posix.isAbsolute(""), false);
- if (path.win32) assertEqual(path.win32.isAbsolute(""), false);
+ assertEq(path.posix.isAbsolute(""), false);
+ if (path.win32) assertEq(path.win32.isAbsolute(""), false);
});
test(function resolveZeroLength() {
// resolve, internally ignores all the zero-length strings and returns the
// current working directory
- assertEqual(path.resolve(""), pwd);
- assertEqual(path.resolve("", ""), pwd);
+ assertEq(path.resolve(""), pwd);
+ assertEq(path.resolve("", ""), pwd);
});
test(function relativeZeroLength() {
// relative, internally calls resolve. So, '' is actually the current directory
- assertEqual(path.relative("", pwd), "");
- assertEqual(path.relative(pwd, ""), "");
- assertEqual(path.relative(pwd, pwd), "");
+ assertEq(path.relative("", pwd), "");
+ assertEq(path.relative(pwd, ""), "");
+ assertEq(path.relative(pwd, pwd), "");
});