[Pkg-javascript-commits] [node-leveldown] 53/492: ensure readStream options NOT sticky

Andrew Kelley andrewrk-guest at moszumanska.debian.org
Sun Jul 6 17:13:44 UTC 2014


This is an automated email from the git hooks/post-receive script.

andrewrk-guest pushed a commit to annotated tag rocksdb-0.10.1
in repository node-leveldown.

commit 6eb361dc1c2647a12e51fc9781ddc858ea426251
Author: Rod Vagg <rod at vagg.org>
Date:   Thu Oct 18 10:00:17 2012 +1100

    ensure readStream options NOT sticky
---
 .jshintrc                |  1 -
 lib/levelup.js           |  2 +-
 test/common.js           |  2 +-
 test/read-stream-test.js | 21 +++++++++++++++++++++
 4 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/.jshintrc b/.jshintrc
index 9fcbd73..6fac775 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -15,7 +15,6 @@
   , "undef": true
   , "sub": true
   , "white": false
-  , "indent": 2
   , "trailing": true
   , "asi": true
   , "laxbreak": true
diff --git a/lib/levelup.js b/lib/levelup.js
index 4f63a38..2630333 100644
--- a/lib/levelup.js
+++ b/lib/levelup.js
@@ -206,7 +206,7 @@ LevelUP.prototype = {
     }
 
   , readStream: function (options) {
-      options = extend({}, extend(this._options, typeof options == 'object' ? options : {}))
+      options = extend(extend({}, this._options), typeof options == 'object' ? options : {})
       return readStream.create(
           options
         , this
diff --git a/test/common.js b/test/common.js
index 4ab65d6..527609a 100644
--- a/test/common.js
+++ b/test/common.js
@@ -90,5 +90,5 @@ module.exports.commonSetUp = function () {
   this.cleanupDirs = []
   this.closeableDatabases = []
   this.openTestDatabase = module.exports.openTestDatabase.bind(this)
-  this.timeout = 1000
+  this.timeout = 10000
 }
\ No newline at end of file
diff --git a/test/read-stream-test.js b/test/read-stream-test.js
index af7fe1a..5c05817 100644
--- a/test/read-stream-test.js
+++ b/test/read-stream-test.js
@@ -434,4 +434,25 @@ buster.testCase('ReadStream', {
         }.bind(this))
       }.bind(this))
     }
+
+  , 'test readStream() "reverse=true" not sticky (issue #6)': function (done) {
+      this.openTestDatabase(function (db) {
+        // execute
+        db.batch(this.sourceData.slice(), function (err) {
+          refute(err)
+          // read in reverse, assume all's good
+          var rs = db.readStream({ reverse: true })
+          rs.on('close', function () {
+            // now try reading the other way
+            var rs = db.readStream()
+            assert.isFalse(rs.writable)
+            assert.isTrue(rs.readable)
+            rs.on('ready', this.readySpy)
+            rs.on('data' , this.dataSpy)
+            rs.on('end'  , this.endSpy)
+            rs.on('close', this.verify.bind(this, rs, done))
+          }.bind(this))
+        }.bind(this))
+      }.bind(this))
+    }
 })
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-leveldown.git



More information about the Pkg-javascript-commits mailing list