This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Remove tests relying on !process.features.uv

  • Loading branch information...
ry committed Oct 11, 2011
1 parent c8dbaf5 commit 9631e29933c3ac8a568ee8af6f0500e381d88d23
Showing with 39 additions and 144 deletions.
  1. +5 −8 test/internet/test-dns.js
  2. +0 −85 test/simple/test-child-process-deprecated-api.js
  3. +34 −51 test/simple/test-module-load-list.js
View
@@ -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();
});
@@ -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);
-});
@@ -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);

0 comments on commit 9631e29

Please sign in to comment.