forked from nodejs/node-v0.x-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ISSUE nodejs#2554 nodejs#2567] throw if fs args for 'start' or 'end'…
… are strings
- Loading branch information
AJ ONeal
committed
Feb 18, 2012
1 parent
23c4278
commit 79e9f6a
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
(function () { | ||
"use strict"; | ||
|
||
var assert = require('assert'), | ||
fs = require('./fs'), | ||
saneEmitter; | ||
|
||
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('"use strict";', data.toString('utf8'), 'read ' + data.toString('utf8') + ' instead of "use strict";'); | ||
}); | ||
}()); |