From 537c6b3ed9a783b64bec0d41260c13ac84b7feb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E6=9D=89?= Date: Mon, 2 Dec 2019 03:23:35 +0800 Subject: fix realpath behavior in windows (#3425) --- cli/js/realpath_test.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'cli/js/realpath_test.ts') diff --git a/cli/js/realpath_test.ts b/cli/js/realpath_test.ts index 1dc976578..1faac94cc 100644 --- a/cli/js/realpath_test.ts +++ b/cli/js/realpath_test.ts @@ -4,7 +4,11 @@ import { testPerm, assert, assertEquals } from "./test_util.ts"; testPerm({ read: true }, function realpathSyncSuccess(): void { const incompletePath = "cli/tests/fixture.json"; const realPath = Deno.realpathSync(incompletePath); - assert(realPath.startsWith("/")); + if (Deno.build.os !== "win") { + assert(realPath.startsWith("/")); + } else { + assert(/^[A-Z]/.test(realPath)); + } assert(realPath.endsWith(incompletePath)); }); @@ -47,7 +51,11 @@ testPerm({ read: true }, function realpathSyncNotFound(): void { testPerm({ read: true }, async function realpathSuccess(): Promise { const incompletePath = "cli/tests/fixture.json"; const realPath = await Deno.realpath(incompletePath); - assert(realPath.startsWith("/")); + if (Deno.build.os !== "win") { + assert(realPath.startsWith("/")); + } else { + assert(/^[A-Z]/.test(realPath)); + } assert(realPath.endsWith(incompletePath)); }); -- cgit v1.2.3