From 9631e29933c3ac8a568ee8af6f0500e381d88d23 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Tue, 11 Oct 2011 14:46:55 -0700 Subject: [PATCH] Remove tests relying on !process.features.uv --- test/internet/test-dns.js | 13 ++- .../test-child-process-deprecated-api.js | 85 ------------------- test/simple/test-module-load-list.js | 85 ++++++++----------- 3 files changed, 39 insertions(+), 144 deletions(-) delete mode 100644 test/simple/test-child-process-deprecated-api.js diff --git a/test/internet/test-dns.js b/test/internet/test-dns.js index 44f0c257ed..ea5f132e3e 100644 --- a/test/internet/test-dns.js +++ b/test/internet/test-dns.js @@ -24,8 +24,7 @@ var assert = require('assert'), net = require('net_uv'), isIP = net.isIP, isIPv4 = net.isIPv4, - isIPv6 = net.isIPv6, - uv = process.features.uv; + isIPv6 = net.isIPv6; var expected = 0, completed = 0, @@ -59,16 +58,14 @@ function TEST(f) { process.on('exit', function() { - console.log(completed + ' tests completed (using libuv: ' + (!!uv) + ')'); + console.log(completed + ' tests completed'); assert.equal(running, false); assert.strictEqual(expected, completed); }); function checkWrap(req) { - if (uv) { - assert.ok(typeof req === 'object'); - } + assert.ok(typeof req === 'object'); } @@ -154,7 +151,7 @@ TEST(function test_reverse_bogus(done) { } assert.ok(error instanceof Error); - uv && assert.strictEqual(error.errno, 'ENOTIMP'); + assert.strictEqual(error.errno, 'ENOTIMP'); done(); }); @@ -316,7 +313,7 @@ TEST(function test_lookup_failure(done) { var req = dns.lookup('does.not.exist', 4, function(err, ip, family) { assert.ok(err instanceof Error); assert.strictEqual(err.errno, dns.NOTFOUND); - uv && assert.strictEqual(err.errno, 'ENOTFOUND'); + assert.strictEqual(err.errno, 'ENOTFOUND'); done(); }); diff --git a/test/simple/test-child-process-deprecated-api.js b/test/simple/test-child-process-deprecated-api.js deleted file mode 100644 index cc930028e7..0000000000 --- a/test/simple/test-child-process-deprecated-api.js +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// We do not support this API with the libuv backend. -if (process.features.uv) return; - -var common = require('../common'); -var assert = require('assert'); -var spawn = require('child_process').spawn; -var path = require('path'); -var fs = require('fs'); -var exits = 0; - -// Test `env` parameter -// for child_process.spawn(path, args, env, customFds) deprecated api -(function() { - var response = ''; - var child = spawn('/usr/bin/env', [], {'HELLO': 'WORLD'}); - - child.stdout.setEncoding('utf8'); - - child.stdout.addListener('data', function(chunk) { - response += chunk; - }); - - process.addListener('exit', function() { - assert.ok(response.indexOf('HELLO=WORLD') >= 0); - exits++; - }); -})(); - -// Test `customFds` parameter -// for child_process.spawn(path, args, env, customFds) deprecated api -(function() { - var expected = 'hello world'; - var helloPath = path.join(common.tmpDir, 'hello.txt'); - - fs.open(helloPath, 'w', 400, function(err, fd) { - if (err) throw err; - - var child = spawn('/bin/echo', [expected], undefined, [-1, fd]); - - assert.notEqual(child.stdin, null); - assert.equal(child.stdout, null); - assert.notEqual(child.stderr, null); - - child.addListener('exit', function(err) { - if (err) throw err; - - fs.close(fd, function(err) { - if (err) throw err; - - fs.readFile(helloPath, function(err, data) { - if (err) throw err; - - assert.equal(data.toString(), expected + '\n'); - exits++; - }); - }); - }); - }); -})(); - -// Check if all child processes exited -process.addListener('exit', function() { - assert.equal(2, exits); -}); diff --git a/test/simple/test-module-load-list.js b/test/simple/test-module-load-list.js index a6e17c5dd2..4f9e11a1b5 100644 --- a/test/simple/test-module-load-list.js +++ b/test/simple/test-module-load-list.js @@ -64,60 +64,43 @@ checkExpected(); console.log('load console.log. process.stdout._type is ' + process.stdout._type); -if (!process.features.uv) { - // legacy - expected = expected.concat([ - 'NativeModule console', - 'NativeModule net_legacy', - 'NativeModule timers_legacy', - 'Binding timer', - 'NativeModule _linklist', - 'Binding net', - 'NativeModule freelist', - 'Binding io_watcher', - 'NativeModule tty', - 'NativeModule tty_posix', - 'NativeModule readline' - ]); -} else { - switch (process.stdout._type) { - case 'fs': - expected = expected.concat([ - 'NativeModule console', - 'Binding stdio', - 'Binding tty_wrap' - ]); - break; +switch (process.stdout._type) { + case 'fs': + expected = expected.concat([ + 'NativeModule console', + 'Binding stdio', + 'Binding tty_wrap' + ]); + break; - case 'tty': - expected = expected.concat([ - 'NativeModule console', - 'Binding stdio', - 'Binding tty_wrap', - 'NativeModule tty_uv', - 'NativeModule net_uv', - 'NativeModule timers_uv', - 'Binding timer_wrap', - 'NativeModule _linklist' - ]); - break; + case 'tty': + expected = expected.concat([ + 'NativeModule console', + 'Binding stdio', + 'Binding tty_wrap', + 'NativeModule tty_uv', + 'NativeModule net_uv', + 'NativeModule timers_uv', + 'Binding timer_wrap', + 'NativeModule _linklist' + ]); + break; - case 'pipe': - expected = expected.concat([ - 'NativeModule console', - 'Binding stdio', - 'Binding tty_wrap', - 'NativeModule net_uv', - 'NativeModule timers_uv', - 'Binding timer_wrap', - 'NativeModule _linklist', - 'Binding pipe_wrap' - ]); - break; + case 'pipe': + expected = expected.concat([ + 'NativeModule console', + 'Binding stdio', + 'Binding tty_wrap', + 'NativeModule net_uv', + 'NativeModule timers_uv', + 'Binding timer_wrap', + 'NativeModule _linklist', + 'Binding pipe_wrap' + ]); + break; - default: - assert.ok(0, 'prcoess.stdout._type is bad'); - } + default: + assert.ok(0, 'prcoess.stdout._type is bad'); } console.error('process.moduleLoadList', process.moduleLoadList);