Skip to content

Commit

Permalink
refactor(path): prepare for noUncheckedIndexedAccess (#4483)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabelluardo committed Mar 14, 2024
1 parent 1040fb4 commit a49f560
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions path/basename_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const COREUTILS_TESTSUITE = [
[["fs", "x"], "fs"],
[["fs", ""], "fs"],
[["fs/", "s/"], "fs"],
];
] as const;

const POSIX_TESTSUITE = [
[[""], ""],
Expand Down Expand Up @@ -58,7 +58,7 @@ const POSIX_TESTSUITE = [
[["///"], "/"],
[["///", "bbb"], "/"],
[["//", "bbb"], "/"],
];
] as const;

const WIN32_TESTSUITE = [
[["\\dir\\basename.ext"], "basename.ext"],
Expand All @@ -84,7 +84,7 @@ const WIN32_TESTSUITE = [
[["C:basename.ext\\\\"], "basename.ext"],
[["C:foo"], "foo"],
[["file:stream"], "file:stream"],
];
] as const;

Deno.test("posix.basename()", function () {
for (const [[name, suffix], expected] of COREUTILS_TESTSUITE) {
Expand Down
6 changes: 3 additions & 3 deletions path/dirname_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const COREUTILS_TESTSUITE = [
["///a///b", "///a"],
["///a//b/", "///a"],
["", "."],
];
] as const;

const POSIX_TESTSUITE = [
["/a/b/", "/a"],
Expand All @@ -33,7 +33,7 @@ const POSIX_TESTSUITE = [
["////", "/"],
["//a", "/"],
["foo", "."],
];
] as const;

const WINDOWS_TESTSUITE = [
["c:\\", "c:\\"],
Expand Down Expand Up @@ -69,7 +69,7 @@ const WINDOWS_TESTSUITE = [
["/", "/"],
["////", "/"],
["foo", "."],
];
] as const;

Deno.test("posix.dirname()", function () {
for (const [name, expected] of COREUTILS_TESTSUITE) {
Expand Down
2 changes: 1 addition & 1 deletion path/extname_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const pairs = [
["file//", ""],
["file./", "."],
["file.//", "."],
];
] as const;

Deno.test("posix.extname()", function () {
pairs.forEach(function (p) {
Expand Down
4 changes: 2 additions & 2 deletions path/relative_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const relativeTests = {
["\\\\foo\\baz", "\\\\foo\\baz-quux", "..\\baz-quux"],
["C:\\baz", "\\\\foo\\bar\\baz", "\\\\foo\\bar\\baz"],
["\\\\foo\\bar\\baz", "C:\\baz", "C:\\baz"],
],
] as const,
// arguments result
posix: [
["/var/lib", "/var", ".."],
Expand All @@ -48,7 +48,7 @@ const relativeTests = {
["/foo/bar/baz", "/foo/bar/baz-quux", "../baz-quux"],
["/baz-quux", "/baz", "../baz"],
["/baz", "/baz-quux", "../baz-quux"],
],
] as const,
};

Deno.test("posix.relative()", function () {
Expand Down

0 comments on commit a49f560

Please sign in to comment.