Permalink
Browse files

Compatibility with node HEAD

  • Loading branch information...
1 parent 7b60942 commit 720f4a319426f606396ed00e69df4a24edc1d93c @felixge committed Oct 18, 2010
View
@@ -1,6 +1,6 @@
require('../test/common');
var http = require('http')
- , sys = require('sys')
+ , util = require('util')
, formidable = require('formidable')
, server;
@@ -21,7 +21,7 @@ server = http.createServer(function(req, res) {
form
.addListener('error', function(err) {
res.writeHead(200, {'content-type': 'text/plain'});
- res.end('error:\n\n'+sys.inspect(err));
+ res.end('error:\n\n'+util.inspect(err));
})
.addListener('field', function(field, value) {
p([field, value]);
@@ -30,7 +30,7 @@ server = http.createServer(function(req, res) {
.addListener('end', function() {
puts('-> post done');
res.writeHead(200, {'content-type': 'text/plain'});
- res.end('received fields:\n\n '+sys.inspect(fields));
+ res.end('received fields:\n\n '+util.inspect(fields));
});
form.parse(req);
} else {
@@ -40,4 +40,4 @@ server = http.createServer(function(req, res) {
});
server.listen(TEST_PORT);
-sys.puts('listening on http://localhost:'+TEST_PORT+'/');
+util.puts('listening on http://localhost:'+TEST_PORT+'/');
View
@@ -1,6 +1,6 @@
require('../test/common');
var http = require('http')
- , sys = require('sys')
+ , util = require('util')
, formidable = require('formidable')
, server;
@@ -33,9 +33,9 @@ server = http.createServer(function(req, res) {
.addListener('end', function() {
puts('-> upload done');
res.writeHead(200, {'content-type': 'text/plain'});
- res.write('received fields:\n\n '+sys.inspect(fields));
+ res.write('received fields:\n\n '+util.inspect(fields));
res.write('\n\n');
- res.end('received files:\n\n '+sys.inspect(files));
+ res.end('received files:\n\n '+util.inspect(files));
});
form.parse(req);
} else {
@@ -45,4 +45,4 @@ server = http.createServer(function(req, res) {
});
server.listen(TEST_PORT);
-sys.puts('listening on http://localhost:'+TEST_PORT+'/');
+util.puts('listening on http://localhost:'+TEST_PORT+'/');
@@ -1,6 +1,6 @@
if (global.GENTLY) require = GENTLY.hijack(require);
-var sys = require('sys')
+var util = require('./util')
, path = require('path')
, WriteStream = require('fs').WriteStream
, MultipartParser = require('./multipart_parser').MultipartParser
@@ -29,7 +29,7 @@ function IncomingForm() {
this._flushing = 0;
this._fieldsSize = 0;
};
-sys.inherits(IncomingForm, EventEmitter);
+util.inherits(IncomingForm, EventEmitter);
exports.IncomingForm = IncomingForm;
IncomingForm.prototype.parse = function(req, cb) {
View
@@ -1,9 +1,9 @@
var path = require('path')
, fs = require('fs')
- , sys = require('sys')
, timeout;
require.paths.unshift(path.dirname(__dirname)+'/lib');
+var util = require('formidable/util');
try {
global.Gently = require('gently');
@@ -13,9 +13,9 @@ try {
global.GENTLY = new Gently();
-global.puts = sys.puts;
+global.puts = util.puts;
global.p = function() {
- sys.error(sys.inspect.apply(null, arguments));
+ util.error(util.inspect.apply(null, arguments));
};
global.assert = require('assert');
global.TEST_PORT = 13532;
@@ -58,4 +58,4 @@ assert.properties = function(obj, properties) {
'does not have property: '+property
);
}
-};
+};
@@ -1,6 +1,3 @@
-var puts = require('sys').puts;
-var p = require('sys').p;
-
exports['rfc1867'] =
{ boundary: 'AaB03x'
, raw:
@@ -44,4 +41,4 @@ exports['emptyHeader'] =
'... contents of file1.txt ...\r\r\n'+
'--AaB03x--\r\n'
, expectError: true
- };
+ };
@@ -43,7 +43,7 @@ Object.keys(fixtures).forEach(function(name) {
parser.onPartData = function(b, start, end) {
var str = b.toString('ascii', start, end);
- part.data += b.binarySlice(start, end);
+ part.data += b.slice(start, end);
}
parser.onEnd = function() {
@@ -77,4 +77,4 @@ Object.keys(fixtures).forEach(function(name) {
assert.ok(endCalled);
assert.deepEqual(parts, fixture.parts);
-});
+});
@@ -2,7 +2,7 @@ require('../common');
var BOUNDARY = '---------------------------10102754414578508781458777923'
, FIXTURE = TEST_FIXTURES+'/multi_video.upload'
, fs = require('fs')
- , sys = require('sys')
+ , util = require('formidable/util')
, http = require('http')
, formidable = require('formidable')
, server = http.createServer();
@@ -53,4 +53,4 @@ server.listen(TEST_PORT, function() {
.addListener('end', function() {
request.end();
});
-});
+});

0 comments on commit 720f4a3

Please sign in to comment.