test: use common platform helpers everywhere · nodejs/node@8f51e36 · GitHub
Skip to content

Commit 8f51e36

Browse files
santigimenocjihrig
authored andcommitted
test: use common platform helpers everywhere
Use the common.isWindows, common.isFreeBSD and common.isSunOS where possible. Add common.isOSX and common.isLinux. Fix `test-fs-read-file-sync-hostname` as in its current form was not being run anywhere. PR-URL: #7845 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent e6887e2 commit 8f51e36

26 files changed

Lines changed: 46 additions & 40 deletions

test/common.js

Lines changed: 6 additions & 4 deletions

test/internet/test-dns-ipv6.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ TEST(function test_lookup_ipv6_hint(done) {
123123
}, function(err, ip, family) {
124124
if (err) {
125125
// FreeBSD does not support V4MAPPED
126-
if (process.platform === 'freebsd') {
126+
if (common.isFreeBSD) {
127127
assert(err instanceof Error);
128128
assert.strictEqual(err.code, 'EAI_BADFLAGS');
129129
assert.strictEqual(err.hostname, 'www.google.com');

test/parallel/test-cwd-enoent-preload.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const fs = require('fs');
55
const spawn = require('child_process').spawn;
66

77
// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX.
8-
if (process.platform === 'sunos' || common.isWindows || common.isAix) {
8+
if (common.isSunOS || common.isWindows || common.isAix) {
99
common.skip('cannot rmdir current working directory');
1010
return;
1111
}

test/parallel/test-cwd-enoent-repl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var fs = require('fs');
55
var spawn = require('child_process').spawn;
66

77
// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX.
8-
if (process.platform === 'sunos' || common.isWindows || common.isAix) {
8+
if (common.isSunOS || common.isWindows || common.isAix) {
99
common.skip('cannot rmdir current working directory');
1010
return;
1111
}

test/parallel/test-cwd-enoent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var fs = require('fs');
55
var spawn = require('child_process').spawn;
66

77
// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX.
8-
if (process.platform === 'sunos' || common.isWindows || common.isAix) {
8+
if (common.isSunOS || common.isWindows || common.isAix) {
99
common.skip('cannot rmdir current working directory');
1010
return;
1111
}

test/parallel/test-dgram-empty-packet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var callbacks = 0;
66
var client;
77
var timer;
88

9-
if (process.platform === 'darwin') {
9+
if (common.isOSX) {
1010
common.skip('because of 17894467 Apple bug');
1111
return;
1212
}

test/parallel/test-dgram-send-empty-array.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const common = require('../common');
44
const assert = require('assert');
55
const dgram = require('dgram');
66

7-
if (process.platform === 'darwin') {
7+
if (common.isOSX) {
88
common.skip('because of 17894467 Apple bug');
99
return;
1010
}

test/parallel/test-dgram-send-empty-buffer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
const common = require('../common');
33
const dgram = require('dgram');
44

5-
if (process.platform === 'darwin') {
5+
if (common.isOSX) {
66
common.skip('because of 17894467 Apple bug');
77
return;
88
}

test/parallel/test-domain-abort-on-uncaught.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ if (process.argv[2] === 'child') {
233233

234234
tests.forEach(function(test, testIndex) {
235235
var testCmd = '';
236-
if (process.platform !== 'win32') {
236+
if (!common.isWindows) {
237237
// Do not create core files, as it can take a lot of disk space on
238238
// continuous testing and developers' machines
239239
testCmd += 'ulimit -c 0 && ';

test/parallel/test-domain-no-error-handler-abort-on-uncaught.js

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)