From e6f17979af9bec29fbd5e0ef387d298249c9667d Mon Sep 17 00:00:00 2001 From: Farrin Reid Date: Sat, 23 Jun 2012 16:40:14 -0800 Subject: [PATCH] [fix] Changed require('util') to require('util') for compatibility with node v0.8 --- examples/web.js | 2 +- test.js | 14 +++++++------- test/nodeunit/nodeunit.js | 6 +++--- test/nodeunit/testrunner.js | 14 +++++++------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/web.js b/examples/web.js index c04740f..1b92282 100755 --- a/examples/web.js +++ b/examples/web.js @@ -2,7 +2,7 @@ var http = require('http'); var events = require('events'); -var inherits = require('sys').inherits; +var inherits = require('util').inherits; var nquery = require('../lib/nquery'); function WebClient(host, path) { diff --git a/test.js b/test.js index 69e6754..d17cd2b 100755 --- a/test.js +++ b/test.js @@ -8,13 +8,13 @@ try { var testrunner = require('nodeunit').testrunner; } catch(e) { - var sys = require('sys'); - sys.puts("Cannot find nodeunit module."); - sys.puts("You can download submodules for this project by doing:"); - sys.puts(""); - sys.puts(" git submodule init"); - sys.puts(" git submodule update"); - sys.puts(""); + var util = require('util'); + util.puts("Cannot find nodeunit module."); + util.puts("You can download submodules for this project by doing:"); + util.puts(""); + util.puts(" git submodule init"); + util.puts(" git submodule update"); + util.puts(""); process.exit(); } diff --git a/test/nodeunit/nodeunit.js b/test/nodeunit/nodeunit.js index 25aef75..9ae5e03 100644 --- a/test/nodeunit/nodeunit.js +++ b/test/nodeunit/nodeunit.js @@ -1,6 +1,6 @@ var assert = require('assert'), fs = require('fs'), - sys = require('sys'); + util = require('util'); exports.testrunner = require('./testrunner'); @@ -45,8 +45,8 @@ var testEnv = function(start, options){ if(Object.getOwnPropertyDescriptor(e,'actual') && Object.getOwnPropertyDescriptor(e,'expected')){ - var actual = sys.inspect(e.actual).replace(/\n$/,''); - var expected = sys.inspect(e.expected).replace(/\n$/,''); + var actual = util.inspect(e.actual).replace(/\n$/,''); + var expected = util.inspect(e.expected).replace(/\n$/,''); var multiline = ( actual.indexOf('\n') != -1 || expected.indexOf('\n') != -1 diff --git a/test/nodeunit/testrunner.js b/test/nodeunit/testrunner.js index c79bcec..6e63814 100644 --- a/test/nodeunit/testrunner.js +++ b/test/nodeunit/testrunner.js @@ -1,5 +1,5 @@ var nodeunit = require('./nodeunit'), - sys = require('sys'); + util = require('util'); @@ -13,17 +13,17 @@ exports.run = function(files){ nodeunit.runFiles(files, { moduleStart: function(name){ - sys.puts('\n' + bold(name)); + util.puts('\n' + bold(name)); }, testDone: function(name, assertions){ if(!assertions.failures){ - sys.puts('✔ ' + name); + util.puts('✔ ' + name); } else { - sys.puts(red('✖ ' + name) + '\n'); + util.puts(red('✖ ' + name) + '\n'); assertions.forEach(function(assertion){ if(assertion.failed()){ - sys.puts(assertion.error.stack + '\n'); + util.puts(assertion.error.stack + '\n'); } }); } @@ -32,14 +32,14 @@ exports.run = function(files){ var end = new Date().getTime(); var duration = end - start; if(assertions.failures){ - sys.puts( + util.puts( '\n' + bold(red('FAILURES: ')) + assertions.failures + '/' + assertions.length + ' assertions failed (' + assertions.duration + 'ms)' ); } else { - sys.puts( + util.puts( '\n' + bold(green('OK: ')) + assertions.length + ' assertions (' + assertions.duration + 'ms)' );