From 512016fd7441d8919c29f369a38622ab1dd01942 Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Wed, 8 Sep 2010 12:09:13 -0700 Subject: [PATCH] Test for ReadStream typo --- test/simple/test-fs-read-stream.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/simple/test-fs-read-stream.js b/test/simple/test-fs-read-stream.js index 74c036c2e8..db1275a9a5 100644 --- a/test/simple/test-fs-read-stream.js +++ b/test/simple/test-fs-read-stream.js @@ -96,3 +96,17 @@ file4.addListener('data', function(data) { file4.addListener('end', function(data) { assert.equal(contentRead, 'yz'); }); + +try { + fs.createReadStream(rangeFile, {start: 10, end: 2}); + assert.fail('Creating a ReadStream with incorrect range limits must throw.'); +} catch(e) { + assert.equal(e.message, 'start must be <= end'); +} + +try { + fs.createReadStream(rangeFile, {start: 2}); + assert.fail('Creating a ReadStream with a only one range limits must throw.'); +} catch(e) { + assert.equal(e.message, 'Both start and end are needed for range streaming.'); +}