mirror of
https://github.com/denoland/std.git
synced 2024-11-22 04:59:05 +00:00
d102a10235
* refactor: import from `@std/assert` * update
34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
|
|
import * as posix from "./posix/mod.ts";
|
|
import * as windows from "./windows/mod.ts";
|
|
import { assertEquals } from "@std/assert";
|
|
|
|
Deno.test("windows.toNamespacedPath() returns the namespaced path", () => {
|
|
{
|
|
const path = "C:\\path\\to\\file.txt";
|
|
const namespacedPath = windows.toNamespacedPath(path);
|
|
assertEquals(namespacedPath, "\\\\?\\C:\\path\\to\\file.txt");
|
|
}
|
|
|
|
// The path starts with double backslashs
|
|
{
|
|
const path = "\\\\path\\to\\file.txt";
|
|
const namespacedPath = windows.toNamespacedPath(path);
|
|
assertEquals(namespacedPath, "\\\\?\\UNC\\path\\to\\file.txt");
|
|
}
|
|
|
|
// When the input is empty string
|
|
{
|
|
const path = "";
|
|
const namespacedPath = windows.toNamespacedPath(path);
|
|
assertEquals(namespacedPath, "");
|
|
}
|
|
});
|
|
|
|
Deno.test("posix.toNamespacedPath() return the input as is", () => {
|
|
const path = "/path/to/file.txt";
|
|
const namespacedPath = posix.toNamespacedPath(path);
|
|
assertEquals(namespacedPath, "/path/to/file.txt");
|
|
});
|