Skip to content

Commit 512016f

Browse files
tobiery
authored andcommitted
Test for ReadStream typo
1 parent 0e501f4 commit 512016f

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

test/simple/test-fs-read-stream.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,17 @@ file4.addListener('data', function(data) {
9696
file4.addListener('end', function(data) {
9797
assert.equal(contentRead, 'yz');
9898
});
99+
100+
try {
101+
fs.createReadStream(rangeFile, {start: 10, end: 2});
102+
assert.fail('Creating a ReadStream with incorrect range limits must throw.');
103+
} catch(e) {
104+
assert.equal(e.message, 'start must be <= end');
105+
}
106+
107+
try {
108+
fs.createReadStream(rangeFile, {start: 2});
109+
assert.fail('Creating a ReadStream with a only one range limits must throw.');
110+
} catch(e) {
111+
assert.equal(e.message, 'Both start and end are needed for range streaming.');
112+
}

0 commit comments

Comments
 (0)