summaryrefslogtreecommitdiff
path: root/fs/path
diff options
context:
space:
mode:
Diffstat (limited to 'fs/path')
-rw-r--r--fs/path/basename_test.ts111
-rw-r--r--fs/path/dirname_test.ts84
-rw-r--r--fs/path/extname_test.ts40
-rw-r--r--fs/path/isabsolute_test.ts46
-rw-r--r--fs/path/join_test.ts8
-rw-r--r--fs/path/parse_format_test.ts28
-rw-r--r--fs/path/relative_test.ts6
-rw-r--r--fs/path/resolve_test.ts6
-rw-r--r--fs/path/zero_length_strings_test.ts34
9 files changed, 183 insertions, 180 deletions
diff --git a/fs/path/basename_test.ts b/fs/path/basename_test.ts
index b4b6f1303..f7770d1ca 100644
--- a/fs/path/basename_test.ts
+++ b/fs/path/basename_test.ts
@@ -2,72 +2,75 @@
// Ported from https://github.com/browserify/path-browserify/
import { test } from "../../testing/mod.ts";
-import { assertEq } from "../../testing/asserts.ts";
+import { assertEquals } from "../../testing/asserts.ts";
import * as path from "./mod.ts";
test(function basename() {
- 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");
+ assertEquals(path.basename(".js", ".js"), "");
+ assertEquals(path.basename(""), "");
+ assertEquals(path.basename("/dir/basename.ext"), "basename.ext");
+ assertEquals(path.basename("/basename.ext"), "basename.ext");
+ assertEquals(path.basename("basename.ext"), "basename.ext");
+ assertEquals(path.basename("basename.ext/"), "basename.ext");
+ assertEquals(path.basename("basename.ext//"), "basename.ext");
+ assertEquals(path.basename("aaa/bbb", "/bbb"), "bbb");
+ assertEquals(path.basename("aaa/bbb", "a/bbb"), "bbb");
+ assertEquals(path.basename("aaa/bbb", "bbb"), "bbb");
+ assertEquals(path.basename("aaa/bbb//", "bbb"), "bbb");
+ assertEquals(path.basename("aaa/bbb", "bb"), "b");
+ assertEquals(path.basename("aaa/bbb", "b"), "bb");
+ assertEquals(path.basename("/aaa/bbb", "/bbb"), "bbb");
+ assertEquals(path.basename("/aaa/bbb", "a/bbb"), "bbb");
+ assertEquals(path.basename("/aaa/bbb", "bbb"), "bbb");
+ assertEquals(path.basename("/aaa/bbb//", "bbb"), "bbb");
+ assertEquals(path.basename("/aaa/bbb", "bb"), "b");
+ assertEquals(path.basename("/aaa/bbb", "b"), "bb");
+ assertEquals(path.basename("/aaa/bbb"), "bbb");
+ assertEquals(path.basename("/aaa/"), "aaa");
+ assertEquals(path.basename("/aaa/b"), "b");
+ assertEquals(path.basename("/a/b"), "b");
+ assertEquals(path.basename("//a"), "a");
// On unix a backslash is just treated as any other character.
- 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");
+ assertEquals(
+ path.posix.basename("\\dir\\basename.ext"),
+ "\\dir\\basename.ext"
+ );
+ assertEquals(path.posix.basename("\\basename.ext"), "\\basename.ext");
+ assertEquals(path.posix.basename("basename.ext"), "basename.ext");
+ assertEquals(path.posix.basename("basename.ext\\"), "basename.ext\\");
+ assertEquals(path.posix.basename("basename.ext\\\\"), "basename.ext\\\\");
+ assertEquals(path.posix.basename("foo"), "foo");
// POSIX filenames may include control characters
const controlCharFilename = "Icon" + String.fromCharCode(13);
- assertEq(
+ assertEquals(
path.posix.basename("/a/b/" + controlCharFilename),
controlCharFilename
);
});
test(function basenameWin32() {
- 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");
+ assertEquals(path.win32.basename("\\dir\\basename.ext"), "basename.ext");
+ assertEquals(path.win32.basename("\\basename.ext"), "basename.ext");
+ assertEquals(path.win32.basename("basename.ext"), "basename.ext");
+ assertEquals(path.win32.basename("basename.ext\\"), "basename.ext");
+ assertEquals(path.win32.basename("basename.ext\\\\"), "basename.ext");
+ assertEquals(path.win32.basename("foo"), "foo");
+ assertEquals(path.win32.basename("aaa\\bbb", "\\bbb"), "bbb");
+ assertEquals(path.win32.basename("aaa\\bbb", "a\\bbb"), "bbb");
+ assertEquals(path.win32.basename("aaa\\bbb", "bbb"), "bbb");
+ assertEquals(path.win32.basename("aaa\\bbb\\\\\\\\", "bbb"), "bbb");
+ assertEquals(path.win32.basename("aaa\\bbb", "bb"), "b");
+ assertEquals(path.win32.basename("aaa\\bbb", "b"), "bb");
+ assertEquals(path.win32.basename("C:"), "");
+ assertEquals(path.win32.basename("C:."), ".");
+ assertEquals(path.win32.basename("C:\\"), "");
+ assertEquals(path.win32.basename("C:\\dir\\base.ext"), "base.ext");
+ assertEquals(path.win32.basename("C:\\basename.ext"), "basename.ext");
+ assertEquals(path.win32.basename("C:basename.ext"), "basename.ext");
+ assertEquals(path.win32.basename("C:basename.ext\\"), "basename.ext");
+ assertEquals(path.win32.basename("C:basename.ext\\\\"), "basename.ext");
+ assertEquals(path.win32.basename("C:foo"), "foo");
+ assertEquals(path.win32.basename("file:stream"), "file:stream");
});
diff --git a/fs/path/dirname_test.ts b/fs/path/dirname_test.ts
index cf52f067d..047d4859b 100644
--- a/fs/path/dirname_test.ts
+++ b/fs/path/dirname_test.ts
@@ -2,61 +2,61 @@
// Ported from https://github.com/browserify/path-browserify/
import { test } from "../../testing/mod.ts";
-import { assertEq } from "../../testing/asserts.ts";
+import { assertEquals } from "../../testing/asserts.ts";
import * as path from "./mod.ts";
test(function dirname() {
- 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"), ".");
+ assertEquals(path.posix.dirname("/a/b/"), "/a");
+ assertEquals(path.posix.dirname("/a/b"), "/a");
+ assertEquals(path.posix.dirname("/a"), "/");
+ assertEquals(path.posix.dirname(""), ".");
+ assertEquals(path.posix.dirname("/"), "/");
+ assertEquals(path.posix.dirname("////"), "/");
+ assertEquals(path.posix.dirname("//a"), "//");
+ assertEquals(path.posix.dirname("foo"), ".");
});
test(function dirnameWin32() {
- 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(
+ assertEquals(path.win32.dirname("c:\\"), "c:\\");
+ assertEquals(path.win32.dirname("c:\\foo"), "c:\\");
+ assertEquals(path.win32.dirname("c:\\foo\\"), "c:\\");
+ assertEquals(path.win32.dirname("c:\\foo\\bar"), "c:\\foo");
+ assertEquals(path.win32.dirname("c:\\foo\\bar\\"), "c:\\foo");
+ assertEquals(path.win32.dirname("c:\\foo\\bar\\baz"), "c:\\foo\\bar");
+ assertEquals(path.win32.dirname("\\"), "\\");
+ assertEquals(path.win32.dirname("\\foo"), "\\");
+ assertEquals(path.win32.dirname("\\foo\\"), "\\");
+ assertEquals(path.win32.dirname("\\foo\\bar"), "\\foo");
+ assertEquals(path.win32.dirname("\\foo\\bar\\"), "\\foo");
+ assertEquals(path.win32.dirname("\\foo\\bar\\baz"), "\\foo\\bar");
+ assertEquals(path.win32.dirname("c:"), "c:");
+ assertEquals(path.win32.dirname("c:foo"), "c:");
+ assertEquals(path.win32.dirname("c:foo\\"), "c:");
+ assertEquals(path.win32.dirname("c:foo\\bar"), "c:foo");
+ assertEquals(path.win32.dirname("c:foo\\bar\\"), "c:foo");
+ assertEquals(path.win32.dirname("c:foo\\bar\\baz"), "c:foo\\bar");
+ assertEquals(path.win32.dirname("file:stream"), ".");
+ assertEquals(path.win32.dirname("dir\\file:stream"), "dir");
+ assertEquals(path.win32.dirname("\\\\unc\\share"), "\\\\unc\\share");
+ assertEquals(path.win32.dirname("\\\\unc\\share\\foo"), "\\\\unc\\share\\");
+ assertEquals(path.win32.dirname("\\\\unc\\share\\foo\\"), "\\\\unc\\share\\");
+ assertEquals(
path.win32.dirname("\\\\unc\\share\\foo\\bar"),
"\\\\unc\\share\\foo"
);
- assertEq(
+ assertEquals(
path.win32.dirname("\\\\unc\\share\\foo\\bar\\"),
"\\\\unc\\share\\foo"
);
- assertEq(
+ assertEquals(
path.win32.dirname("\\\\unc\\share\\foo\\bar\\baz"),
"\\\\unc\\share\\foo\\bar"
);
- 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"), ".");
+ assertEquals(path.win32.dirname("/a/b/"), "/a");
+ assertEquals(path.win32.dirname("/a/b"), "/a");
+ assertEquals(path.win32.dirname("/a"), "/");
+ assertEquals(path.win32.dirname(""), ".");
+ assertEquals(path.win32.dirname("/"), "/");
+ assertEquals(path.win32.dirname("////"), "/");
+ assertEquals(path.win32.dirname("foo"), ".");
});
diff --git a/fs/path/extname_test.ts b/fs/path/extname_test.ts
index 08f780e7d..336d6b0b2 100644
--- a/fs/path/extname_test.ts
+++ b/fs/path/extname_test.ts
@@ -2,7 +2,7 @@
// Ported from https://github.com/browserify/path-browserify/
import { test } from "../../testing/mod.ts";
-import { assertEq } from "../../testing/asserts.ts";
+import { assertEquals } from "../../testing/asserts.ts";
import * as path from "./mod.ts";
const slashRE = /\//g;
@@ -56,35 +56,35 @@ test(function extname() {
pairs.forEach(function(p) {
const input = p[0];
const expected = p[1];
- assertEq(expected, path.posix.extname(input));
+ assertEquals(expected, path.posix.extname(input));
});
// On *nix, backslash is a valid name component like any other character.
- 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.\\\\"), ".\\\\");
+ assertEquals(path.posix.extname(".\\"), "");
+ assertEquals(path.posix.extname("..\\"), ".\\");
+ assertEquals(path.posix.extname("file.ext\\"), ".ext\\");
+ assertEquals(path.posix.extname("file.ext\\\\"), ".ext\\\\");
+ assertEquals(path.posix.extname("file\\"), "");
+ assertEquals(path.posix.extname("file\\\\"), "");
+ assertEquals(path.posix.extname("file.\\"), ".\\");
+ assertEquals(path.posix.extname("file.\\\\"), ".\\\\");
});
test(function extnameWin32() {
pairs.forEach(function(p) {
const input = p[0].replace(slashRE, "\\");
const expected = p[1];
- assertEq(expected, path.win32.extname(input));
- assertEq(expected, path.win32.extname("C:" + input));
+ assertEquals(expected, path.win32.extname(input));
+ assertEquals(expected, path.win32.extname("C:" + input));
});
// On Windows, backslash is a path separator.
- 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.\\\\"), ".");
+ assertEquals(path.win32.extname(".\\"), "");
+ assertEquals(path.win32.extname("..\\"), "");
+ assertEquals(path.win32.extname("file.ext\\"), ".ext");
+ assertEquals(path.win32.extname("file.ext\\\\"), ".ext");
+ assertEquals(path.win32.extname("file\\"), "");
+ assertEquals(path.win32.extname("file\\\\"), "");
+ assertEquals(path.win32.extname("file.\\"), ".");
+ assertEquals(path.win32.extname("file.\\\\"), ".");
});
diff --git a/fs/path/isabsolute_test.ts b/fs/path/isabsolute_test.ts
index 7b262e354..87218a185 100644
--- a/fs/path/isabsolute_test.ts
+++ b/fs/path/isabsolute_test.ts
@@ -2,33 +2,33 @@
// Ported from https://github.com/browserify/path-browserify/
import { test } from "../../testing/mod.ts";
-import { assertEq } from "../../testing/asserts.ts";
+import { assertEquals } from "../../testing/asserts.ts";
import * as path from "./mod.ts";
test(function isAbsolute() {
- 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);
+ assertEquals(path.posix.isAbsolute("/home/foo"), true);
+ assertEquals(path.posix.isAbsolute("/home/foo/.."), true);
+ assertEquals(path.posix.isAbsolute("bar/"), false);
+ assertEquals(path.posix.isAbsolute("./baz"), false);
});
test(function isAbsoluteWin32() {
- 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);
+ assertEquals(path.win32.isAbsolute("/"), true);
+ assertEquals(path.win32.isAbsolute("//"), true);
+ assertEquals(path.win32.isAbsolute("//server"), true);
+ assertEquals(path.win32.isAbsolute("//server/file"), true);
+ assertEquals(path.win32.isAbsolute("\\\\server\\file"), true);
+ assertEquals(path.win32.isAbsolute("\\\\server"), true);
+ assertEquals(path.win32.isAbsolute("\\\\"), true);
+ assertEquals(path.win32.isAbsolute("c"), false);
+ assertEquals(path.win32.isAbsolute("c:"), false);
+ assertEquals(path.win32.isAbsolute("c:\\"), true);
+ assertEquals(path.win32.isAbsolute("c:/"), true);
+ assertEquals(path.win32.isAbsolute("c://"), true);
+ assertEquals(path.win32.isAbsolute("C:/Users/"), true);
+ assertEquals(path.win32.isAbsolute("C:\\Users\\"), true);
+ assertEquals(path.win32.isAbsolute("C:cwd/another"), false);
+ assertEquals(path.win32.isAbsolute("C:cwd\\another"), false);
+ assertEquals(path.win32.isAbsolute("directory/directory"), false);
+ assertEquals(path.win32.isAbsolute("directory\\directory"), false);
});
diff --git a/fs/path/join_test.ts b/fs/path/join_test.ts
index acf5a8096..d82a1b471 100644
--- a/fs/path/join_test.ts
+++ b/fs/path/join_test.ts
@@ -1,5 +1,5 @@
import { test } from "../../testing/mod.ts";
-import { assertEq } from "../../testing/asserts.ts";
+import { assertEquals } from "../../testing/asserts.ts";
import * as path from "./mod.ts";
const backslashRE = /\\/g;
@@ -109,17 +109,17 @@ const windowsJoinTests = [
test(function join() {
joinTests.forEach(function(p) {
const actual = path.posix.join.apply(null, p[0]);
- assertEq(actual, p[1]);
+ assertEquals(actual, p[1]);
});
});
test(function joinWin32() {
joinTests.forEach(function(p) {
const actual = path.win32.join.apply(null, p[0]).replace(backslashRE, "/");
- assertEq(actual, p[1]);
+ assertEquals(actual, p[1]);
});
windowsJoinTests.forEach(function(p) {
const actual = path.win32.join.apply(null, p[0]);
- assertEq(actual, p[1]);
+ assertEquals(actual, p[1]);
});
});
diff --git a/fs/path/parse_format_test.ts b/fs/path/parse_format_test.ts
index 3bf3c462b..29d840453 100644
--- a/fs/path/parse_format_test.ts
+++ b/fs/path/parse_format_test.ts
@@ -2,7 +2,7 @@
// Ported from https://github.com/browserify/path-browserify/
import { test } from "../../testing/mod.ts";
-import { assertEq } from "../../testing/asserts.ts";
+import { assertEquals } from "../../testing/asserts.ts";
import * as path from "./mod.ts";
const winPaths = [
@@ -131,15 +131,15 @@ function checkParseFormat(path, paths) {
paths.forEach(function(p) {
const element = p[0];
const output = path.parse(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));
+ assertEquals(typeof output.root, "string");
+ assertEquals(typeof output.dir, "string");
+ assertEquals(typeof output.base, "string");
+ assertEquals(typeof output.ext, "string");
+ assertEquals(typeof output.name, "string");
+ assertEquals(path.format(output), element);
+ assertEquals(output.rooroot, undefined);
+ assertEquals(output.dir, output.dir ? path.dirname(element) : "");
+ assertEquals(output.base, path.basename(element));
});
}
@@ -149,14 +149,14 @@ function checkSpecialCaseParseFormat(path, testCases) {
const expect = testCase[1];
const output = path.parse(element);
Object.keys(expect).forEach(function(key) {
- assertEq(output[key], expect[key]);
+ assertEquals(output[key], expect[key]);
});
});
}
function checkFormat(path, testCases) {
testCases.forEach(function(testCase) {
- assertEq(path.format(testCase[0]), testCase[1]);
+ assertEquals(path.format(testCase[0]), testCase[1]);
});
}
@@ -164,7 +164,7 @@ test(function parseTrailingWin32() {
windowsTrailingTests.forEach(function(p) {
const actual = path.win32.parse(p[0] as string);
const expected = p[1];
- assertEq(actual, expected);
+ assertEquals(actual, expected);
});
});
@@ -172,6 +172,6 @@ test(function parseTrailing() {
posixTrailingTests.forEach(function(p) {
const actual = path.posix.parse(p[0] as string);
const expected = p[1];
- assertEq(actual, expected);
+ assertEquals(actual, expected);
});
});
diff --git a/fs/path/relative_test.ts b/fs/path/relative_test.ts
index 7a76c4578..0188b5368 100644
--- a/fs/path/relative_test.ts
+++ b/fs/path/relative_test.ts
@@ -2,7 +2,7 @@
// Ported from https://github.com/browserify/path-browserify/
import { test } from "../../testing/mod.ts";
-import { assertEq } from "../../testing/asserts.ts";
+import { assertEquals } from "../../testing/asserts.ts";
import * as path from "./mod.ts";
const relativeTests = {
@@ -60,7 +60,7 @@ test(function relative() {
relativeTests.posix.forEach(function(p) {
const expected = p[2];
const actual = path.posix.relative(p[0], p[1]);
- assertEq(actual, expected);
+ assertEquals(actual, expected);
});
});
@@ -68,6 +68,6 @@ test(function relativeWin32() {
relativeTests.win32.forEach(function(p) {
const expected = p[2];
const actual = path.win32.relative(p[0], p[1]);
- assertEq(actual, expected);
+ assertEquals(actual, expected);
});
});
diff --git a/fs/path/resolve_test.ts b/fs/path/resolve_test.ts
index 7243dc030..7ee9513c1 100644
--- a/fs/path/resolve_test.ts
+++ b/fs/path/resolve_test.ts
@@ -3,7 +3,7 @@
const { cwd } = Deno;
import { test } from "../../testing/mod.ts";
-import { assertEq } from "../../testing/asserts.ts";
+import { assertEquals } from "../../testing/asserts.ts";
import * as path from "./mod.ts";
const windowsTests =
@@ -38,13 +38,13 @@ const posixTests =
test(function resolve() {
posixTests.forEach(function(p) {
const actual = path.posix.resolve.apply(null, p[0]);
- assertEq(actual, p[1]);
+ assertEquals(actual, p[1]);
});
});
test(function resolveWin32() {
windowsTests.forEach(function(p) {
const actual = path.win32.resolve.apply(null, p[0]);
- assertEq(actual, p[1]);
+ assertEquals(actual, p[1]);
});
});
diff --git a/fs/path/zero_length_strings_test.ts b/fs/path/zero_length_strings_test.ts
index 469a0a7c0..20405563c 100644
--- a/fs/path/zero_length_strings_test.ts
+++ b/fs/path/zero_length_strings_test.ts
@@ -3,7 +3,7 @@
const { cwd } = Deno;
import { test } from "../../testing/mod.ts";
-import { assertEq } from "../../testing/asserts.ts";
+import { assertEquals } from "../../testing/asserts.ts";
import * as path from "./mod.ts";
const pwd = cwd();
@@ -11,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.
- 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);
+ assertEquals(path.posix.join(""), ".");
+ assertEquals(path.posix.join("", ""), ".");
+ if (path.win32) assertEquals(path.win32.join(""), ".");
+ if (path.win32) assertEquals(path.win32.join("", ""), ".");
+ assertEquals(path.join(pwd), pwd);
+ assertEquals(path.join(pwd, ""), pwd);
});
test(function normalizeZeroLength() {
// normalize will return '.' if the input is a zero-length string
- assertEq(path.posix.normalize(""), ".");
- if (path.win32) assertEq(path.win32.normalize(""), ".");
- assertEq(path.normalize(pwd), pwd);
+ assertEquals(path.posix.normalize(""), ".");
+ if (path.win32) assertEquals(path.win32.normalize(""), ".");
+ assertEquals(path.normalize(pwd), pwd);
});
test(function isAbsoluteZeroLength() {
// Since '' is not a valid path in any of the common environments, return false
- assertEq(path.posix.isAbsolute(""), false);
- if (path.win32) assertEq(path.win32.isAbsolute(""), false);
+ assertEquals(path.posix.isAbsolute(""), false);
+ if (path.win32) assertEquals(path.win32.isAbsolute(""), false);
});
test(function resolveZeroLength() {
// resolve, internally ignores all the zero-length strings and returns the
// current working directory
- assertEq(path.resolve(""), pwd);
- assertEq(path.resolve("", ""), pwd);
+ assertEquals(path.resolve(""), pwd);
+ assertEquals(path.resolve("", ""), pwd);
});
test(function relativeZeroLength() {
// relative, internally calls resolve. So, '' is actually the current directory
- assertEq(path.relative("", pwd), "");
- assertEq(path.relative(pwd, ""), "");
- assertEq(path.relative(pwd, pwd), "");
+ assertEquals(path.relative("", pwd), "");
+ assertEquals(path.relative(pwd, ""), "");
+ assertEquals(path.relative(pwd, pwd), "");
});