summaryrefslogtreecommitdiff
path: root/std
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2020-04-28 12:35:23 -0400
committerGitHub <noreply@github.com>2020-04-28 12:35:23 -0400
commite0ca60e7707b5896ce67301aefd1de4a76e3cf75 (patch)
tree4c5357a3d3482b14cbc3773374aa885e1e29e90c /std
parentf7ab19b1b7ba929f7fd1550e2e4ecebe91cd9ea3 (diff)
BREAKING: Use LLVM target triple for Deno.build (#4948)
Deno.build.os values have changed to correspond to standard LLVM target triples "win" -> "windows" "mac" -> "darwin"
Diffstat (limited to 'std')
-rw-r--r--std/examples/chat/server_test.ts2
-rw-r--r--std/fs/copy_test.ts2
-rw-r--r--std/fs/ensure_symlink_test.ts2
-rw-r--r--std/fs/walk_test.ts6
-rw-r--r--std/http/file_server_test.ts4
-rw-r--r--std/node/_fs/_fs_chmod_test.ts4
-rw-r--r--std/node/_fs/_fs_chown_test.ts5
-rw-r--r--std/node/_fs/_fs_readlink_test.ts10
-rw-r--r--std/node/os.ts4
-rw-r--r--std/node/process.ts5
-rw-r--r--std/path/constants.ts2
-rw-r--r--std/path/globrex.ts2
-rw-r--r--std/path/globrex_test.ts2
-rw-r--r--std/signal/test.ts6
14 files changed, 26 insertions, 30 deletions
diff --git a/std/examples/chat/server_test.ts b/std/examples/chat/server_test.ts
index e1b1c0e12..47e17314b 100644
--- a/std/examples/chat/server_test.ts
+++ b/std/examples/chat/server_test.ts
@@ -27,7 +27,7 @@ async function startServer(): Promise<Deno.Process> {
}
// TODO: https://github.com/denoland/deno/issues/4108
-const ignore = build.os == "win";
+const ignore = build.os == "windows";
test({
ignore,
diff --git a/std/fs/copy_test.ts b/std/fs/copy_test.ts
index 5323ac9e4..1f3330226 100644
--- a/std/fs/copy_test.ts
+++ b/std/fs/copy_test.ts
@@ -15,7 +15,7 @@ import { ensureSymlink, ensureSymlinkSync } from "./ensure_symlink.ts";
const testdataDir = path.resolve("fs", "testdata");
// TODO(axetroy): Add test for Windows once symlink is implemented for Windows.
-const isWindows = Deno.build.os === "win";
+const isWindows = Deno.build.os === "windows";
function testCopy(name: string, cb: (tempDir: string) => Promise<void>): void {
Deno.test({
diff --git a/std/fs/ensure_symlink_test.ts b/std/fs/ensure_symlink_test.ts
index 2264a6c37..5fda1c86a 100644
--- a/std/fs/ensure_symlink_test.ts
+++ b/std/fs/ensure_symlink_test.ts
@@ -9,7 +9,7 @@ import * as path from "../path/mod.ts";
import { ensureSymlink, ensureSymlinkSync } from "./ensure_symlink.ts";
const testdataDir = path.resolve("fs", "testdata");
-const isWindows = Deno.build.os === "win";
+const isWindows = Deno.build.os === "windows";
Deno.test("ensureSymlinkIfItNotExist", async function (): Promise<void> {
const testDir = path.join(testdataDir, "link_file_1");
diff --git a/std/fs/walk_test.ts b/std/fs/walk_test.ts
index b054db4cf..ea9a33773 100644
--- a/std/fs/walk_test.ts
+++ b/std/fs/walk_test.ts
@@ -3,8 +3,6 @@ const { remove } = Deno;
import { walk, walkSync, WalkOptions, WalkEntry } from "./walk.ts";
import { assert, assertEquals, assertThrowsAsync } from "../testing/asserts.ts";
-const isWindows = Deno.build.os == "win";
-
export function testWalk(
setup: (arg0: string) => void | Promise<void>,
t: () => void | Promise<void>,
@@ -254,13 +252,13 @@ testWalk(
try {
await symlink(d + "/b", d + "/a/bb");
} catch (err) {
- assert(isWindows);
+ assert(Deno.build.os == "windows");
assertEquals(err.message, "Not implemented");
}
},
async function symlink(): Promise<void> {
// symlink is not yet implemented on Windows.
- if (isWindows) {
+ if (Deno.build.os == "windows") {
return;
}
diff --git a/std/http/file_server_test.ts b/std/http/file_server_test.ts
index c377f3bda..eff47c41b 100644
--- a/std/http/file_server_test.ts
+++ b/std/http/file_server_test.ts
@@ -62,9 +62,9 @@ test("serveDirectory", async function (): Promise<void> {
// `Deno.FileInfo` is not completely compatible with Windows yet
// TODO: `mode` should work correctly in the future.
// Correct this test case accordingly.
- Deno.build.os !== "win" &&
+ Deno.build.os !== "windows" &&
assert(/<td class="mode">(\s)*\([a-zA-Z-]{10}\)(\s)*<\/td>/.test(page));
- Deno.build.os === "win" &&
+ Deno.build.os === "windows" &&
assert(/<td class="mode">(\s)*\(unknown mode\)(\s)*<\/td>/.test(page));
assert(page.includes(`<a href="/README.md">README.md</a>`));
} finally {
diff --git a/std/node/_fs/_fs_chmod_test.ts b/std/node/_fs/_fs_chmod_test.ts
index a3d814b51..e43f09788 100644
--- a/std/node/_fs/_fs_chmod_test.ts
+++ b/std/node/_fs/_fs_chmod_test.ts
@@ -5,7 +5,7 @@ import { chmod, chmodSync } from "./_fs_chmod.ts";
test({
name: "ASYNC: Permissions are changed (non-Windows)",
- ignore: Deno.build.os === "win",
+ ignore: Deno.build.os === "windows",
async fn() {
const tempFile: string = await Deno.makeTempFile();
const originalFileMode: number | null = (await Deno.lstat(tempFile)).mode;
@@ -31,7 +31,7 @@ test({
test({
name: "SYNC: Permissions are changed (non-Windows)",
- ignore: Deno.build.os === "win",
+ ignore: Deno.build.os === "windows",
fn() {
const tempFile: string = Deno.makeTempFileSync();
const originalFileMode: number | null = Deno.lstatSync(tempFile).mode;
diff --git a/std/node/_fs/_fs_chown_test.ts b/std/node/_fs/_fs_chown_test.ts
index fd31a8c62..1c1393ac4 100644
--- a/std/node/_fs/_fs_chown_test.ts
+++ b/std/node/_fs/_fs_chown_test.ts
@@ -3,8 +3,9 @@ const { test } = Deno;
import { fail, assertEquals } from "../../testing/asserts.ts";
import { chown, chownSync } from "./_fs_chown.ts";
-//chown is difficult to test. Best we can do is set the existing user id/group id again
-const ignore = Deno.build.os == "win";
+// chown is difficult to test. Best we can do is set the existing user id/group
+// id again
+const ignore = Deno.build.os == "windows";
test({
ignore,
diff --git a/std/node/_fs/_fs_readlink_test.ts b/std/node/_fs/_fs_readlink_test.ts
index 151d3f782..4b2165f8a 100644
--- a/std/node/_fs/_fs_readlink_test.ts
+++ b/std/node/_fs/_fs_readlink_test.ts
@@ -6,13 +6,13 @@ const testDir = Deno.makeTempDirSync();
const oldname = testDir + "/oldname";
const newname = testDir + "/newname";
-if (Deno.build.os !== "win") {
+if (Deno.build.os !== "windows") {
Deno.symlinkSync(oldname, newname);
}
test({
name: "readlinkSuccess",
- ignore: Deno.build.os === "win",
+ ignore: Deno.build.os === "windows",
async fn() {
const data = await new Promise((res, rej) => {
readlink(newname, (err, data) => {
@@ -30,7 +30,7 @@ test({
test({
name: "readlinkEncodeBufferSuccess",
- ignore: Deno.build.os === "win",
+ ignore: Deno.build.os === "windows",
async fn() {
const data = await new Promise((res, rej) => {
readlink(newname, { encoding: "buffer" }, (err, data) => {
@@ -48,7 +48,7 @@ test({
test({
name: "readlinkSyncSuccess",
- ignore: Deno.build.os === "win",
+ ignore: Deno.build.os === "windows",
fn() {
const data = readlinkSync(newname);
assertEquals(typeof data, "string");
@@ -58,7 +58,7 @@ test({
test({
name: "readlinkEncodeBufferSuccess",
- ignore: Deno.build.os === "win",
+ ignore: Deno.build.os === "windows",
fn() {
const data = readlinkSync(newname, { encoding: "buffer" });
assert(data instanceof Uint8Array);
diff --git a/std/node/os.ts b/std/node/os.ts
index 7c61e910b..27b054f4d 100644
--- a/std/node/os.ts
+++ b/std/node/os.ts
@@ -146,7 +146,7 @@ export function hostname(): string {
/** Returns an array containing the 1, 5, and 15 minute load averages */
export function loadavg(): number[] {
- if (Deno.build.os == "win") {
+ if (Deno.build.os === "windows") {
return [0, 0, 0];
}
return Deno.loadavg();
@@ -222,4 +222,4 @@ export const constants = {
},
};
-export const EOL = Deno.build.os == "win" ? fsEOL.CRLF : fsEOL.LF;
+export const EOL = Deno.build.os == "windows" ? fsEOL.CRLF : fsEOL.LF;
diff --git a/std/node/process.ts b/std/node/process.ts
index 89d383e8e..310a7e814 100644
--- a/std/node/process.ts
+++ b/std/node/process.ts
@@ -7,10 +7,7 @@ const versions = {
...Deno.version,
};
-const osToPlatform = (os: Deno.OperatingSystem): string =>
- os === "win" ? "win32" : os === "mac" ? "darwin" : os;
-
-const platform = osToPlatform(Deno.build.os);
+const platform = Deno.build.os === "windows" ? "win32" : Deno.build.os;
const { arch } = Deno.build;
diff --git a/std/path/constants.ts b/std/path/constants.ts
index 1e1eeeb49..97d3bcf58 100644
--- a/std/path/constants.ts
+++ b/std/path/constants.ts
@@ -48,7 +48,7 @@ export const CHAR_EQUAL = 61; /* = */
export const CHAR_0 = 48; /* 0 */
export const CHAR_9 = 57; /* 9 */
-export const isWindows = build.os === "win";
+export const isWindows = build.os === "windows";
export const EOL = isWindows ? "\r\n" : "\n";
export const SEP = isWindows ? "\\" : "/";
export const SEP_PATTERN = isWindows ? /[\\/]+/ : /\/+/;
diff --git a/std/path/globrex.ts b/std/path/globrex.ts
index 0fe833a52..868df797a 100644
--- a/std/path/globrex.ts
+++ b/std/path/globrex.ts
@@ -2,7 +2,7 @@
// MIT License
// Copyright (c) 2018 Terkel Gjervig Nielsen
-const isWin = Deno.build.os === "win";
+const isWin = Deno.build.os === "windows";
const SEP = isWin ? `(?:\\\\|\\/)` : `\\/`;
const SEP_ESC = isWin ? `\\\\` : `/`;
const SEP_RAW = isWin ? `\\` : `/`;
diff --git a/std/path/globrex_test.ts b/std/path/globrex_test.ts
index 27541a5c8..c52ed108e 100644
--- a/std/path/globrex_test.ts
+++ b/std/path/globrex_test.ts
@@ -6,7 +6,7 @@ const { test } = Deno;
import { assertEquals } from "../testing/asserts.ts";
import { GlobrexOptions, globrex } from "./globrex.ts";
-const isWin = Deno.build.os === "win";
+const isWin = Deno.build.os === "windows";
const t = { equal: assertEquals, is: assertEquals };
function match(
diff --git a/std/signal/test.ts b/std/signal/test.ts
index 95529a6e2..c4d1bf3a7 100644
--- a/std/signal/test.ts
+++ b/std/signal/test.ts
@@ -5,7 +5,7 @@ import { signal, onSignal } from "./mod.ts";
test({
name: "signal() throws when called with empty signals",
- ignore: Deno.build.os === "win",
+ ignore: Deno.build.os === "windows",
fn() {
assertThrows(
() => {
@@ -20,7 +20,7 @@ test({
test({
name: "signal() iterates for multiple signals",
- ignore: Deno.build.os === "win",
+ ignore: Deno.build.os === "windows",
fn: async (): Promise<void> => {
// This prevents the program from exiting.
const t = setInterval(() => {}, 1000);
@@ -61,7 +61,7 @@ test({
test({
name: "onSignal() registers and disposes of event handler",
- ignore: Deno.build.os === "win",
+ ignore: Deno.build.os === "windows",
async fn() {
// This prevents the program from exiting.
const t = setInterval(() => {}, 1000);