Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(path): prepare for noUncheckedIndexedAccess #4483

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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