From a49f560dda3e0006439615b3ab6966a75da3be71 Mon Sep 17 00:00:00 2001 From: Gabriele Belluardo Date: Thu, 14 Mar 2024 04:42:03 +0100 Subject: [PATCH] refactor(path): prepare for `noUncheckedIndexedAccess` (#4483) --- path/basename_test.ts | 6 +++--- path/dirname_test.ts | 6 +++--- path/extname_test.ts | 2 +- path/relative_test.ts | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/path/basename_test.ts b/path/basename_test.ts index 9de0a2ca3576..9eead8da334a 100644 --- a/path/basename_test.ts +++ b/path/basename_test.ts @@ -28,7 +28,7 @@ const COREUTILS_TESTSUITE = [ [["fs", "x"], "fs"], [["fs", ""], "fs"], [["fs/", "s/"], "fs"], -]; +] as const; const POSIX_TESTSUITE = [ [[""], ""], @@ -58,7 +58,7 @@ const POSIX_TESTSUITE = [ [["///"], "/"], [["///", "bbb"], "/"], [["//", "bbb"], "/"], -]; +] as const; const WIN32_TESTSUITE = [ [["\\dir\\basename.ext"], "basename.ext"], @@ -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) { diff --git a/path/dirname_test.ts b/path/dirname_test.ts index cd7dd1e8964f..773c7282acc7 100644 --- a/path/dirname_test.ts +++ b/path/dirname_test.ts @@ -22,7 +22,7 @@ const COREUTILS_TESTSUITE = [ ["///a///b", "///a"], ["///a//b/", "///a"], ["", "."], -]; +] as const; const POSIX_TESTSUITE = [ ["/a/b/", "/a"], @@ -33,7 +33,7 @@ const POSIX_TESTSUITE = [ ["////", "/"], ["//a", "/"], ["foo", "."], -]; +] as const; const WINDOWS_TESTSUITE = [ ["c:\\", "c:\\"], @@ -69,7 +69,7 @@ const WINDOWS_TESTSUITE = [ ["/", "/"], ["////", "/"], ["foo", "."], -]; +] as const; Deno.test("posix.dirname()", function () { for (const [name, expected] of COREUTILS_TESTSUITE) { diff --git a/path/extname_test.ts b/path/extname_test.ts index 24c181fbb00d..dce24ac41d51 100644 --- a/path/extname_test.ts +++ b/path/extname_test.ts @@ -50,7 +50,7 @@ const pairs = [ ["file//", ""], ["file./", "."], ["file.//", "."], -]; +] as const; Deno.test("posix.extname()", function () { pairs.forEach(function (p) { diff --git a/path/relative_test.ts b/path/relative_test.ts index 2cc8214a18a8..22944c16dbdf 100644 --- a/path/relative_test.ts +++ b/path/relative_test.ts @@ -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", ".."], @@ -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 () {