mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
0e19476595
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> PR-URL: https://github.com/iojs/io.js/pull/172 Fix: iojs/io.js#139
25 lines
852 B
JavaScript
25 lines
852 B
JavaScript
var assert = require('assert'),
|
|
fs = require('fs'),
|
|
saneEmitter,
|
|
sanity = 'ire(\'assert\')';
|
|
|
|
saneEmitter = fs.createReadStream(__filename, { start: 17, end: 29 });
|
|
|
|
assert.throws(function () {
|
|
fs.createReadStream(__filename, { start: "17", end: 29 });
|
|
}, "start as string didn't throw an error for createReadStream");
|
|
|
|
assert.throws(function () {
|
|
fs.createReadStream(__filename, { start: 17, end: "29" });
|
|
}, "end as string didn't throw an error");
|
|
|
|
assert.throws(function () {
|
|
fs.createWriteStream(__filename, { start: "17" });
|
|
}, "start as string didn't throw an error for createWriteStream");
|
|
|
|
saneEmitter.on('data', function (data) {
|
|
// a sanity check when using numbers instead of strings
|
|
assert.strictEqual(sanity, data.toString('utf8'), 'read ' +
|
|
data.toString('utf8') + ' instead of ' + sanity);
|
|
});
|