[Pkg-javascript-commits] [node-leveldown] 304/492: Merge remote-tracking branch 'origin/start-end-as-empty-string'

Andrew Kelley andrewrk-guest at moszumanska.debian.org
Sun Jul 6 17:14:11 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 f3242cc9a06d8e6120b048b4195edd2528986515
Merge: 60421fe a7b37d2
Author: Rod Vagg <rod at vagg.org>
Date:   Mon Apr 8 09:22:50 2013 +1000

    Merge remote-tracking branch 'origin/start-end-as-empty-string'
    
    Conflicts:
    	test/iterator-test.js

 src/iterator.cc       | 17 +++++++++++++----
 src/leveldown.h       |  7 +++++++
 test/iterator-test.js | 30 ++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+), 4 deletions(-)

diff --cc src/iterator.cc
index afd98ee,235636d..a58c73f
--- a/src/iterator.cc
+++ b/src/iterator.cc
@@@ -235,13 -226,14 +235,14 @@@ v8::Handle<v8::Object> Iterator::NewIns
  v8::Handle<v8::Value> Iterator::New (const v8::Arguments& args) {
    v8::HandleScope scope;
  
 -  //TODO: remove this, it's only here to make LD_STRING_OR_BUFFER_TO_SLICE happy
 -  v8::Local<v8::Function> callback;
 -
    Database* database = node::ObjectWrap::Unwrap<Database>(args[0]->ToObject());
  
 +  //TODO: remove this, it's only here to make LD_STRING_OR_BUFFER_TO_SLICE happy
 +  v8::Handle<v8::Function> callback;
 +
    v8::Local<v8::Value> startBuffer;
    leveldb::Slice* start = NULL;
+   size_t length;
    std::string* end = NULL;
    int limit = -1;
  
diff --cc test/iterator-test.js
index 3938545,14eceac..99fd824
--- a/test/iterator-test.js
+++ b/test/iterator-test.js
@@@ -376,13 -376,35 +376,43 @@@ module.exports.iterator = function (lev
      })
    })
  
 +  test('test iterator with start and end after database and and reverse=true', function (t) {
 +    collectEntries(db.iterator({ start: '9b', end: '9a', reverse: true }), function (err, data) {
 +      t.notOk(err, 'no error')
 +      t.equal(data.length, 0, 'correct number of entries')
 +      t.end()
 +    })
 +  })
++
+   test('test iterator with start as empty buffer', function(t) {
+     collectEntries(db.iterator({ keyAsBuffer: false, valueAsBuffer: false, start: new Buffer(0)}), function (err, data) {
+       t.notOk(err, 'no error')
+       t.equal(data.length, 100, 'correct number of entries')
+       var expected = sourceData.map(transformSource)
+       t.deepEqual(data, expected)
+       t.end()
+     })
+   })
+ 
+   test('test iterator with end as empty string', function(t) {
+     collectEntries(db.iterator({ keyAsBuffer: false, valueAsBuffer: false, end: ''}), function (err, data) {
+       t.notOk(err, 'no error')
+       t.equal(data.length, 100, 'correct number of entries')
+       var expected = sourceData.map(transformSource)
+       t.deepEqual(data, expected)
+       t.end()
+     })
+   })
+ 
+   test('test iterator with end as empty string', function(t) {
+     collectEntries(db.iterator({ keyAsBuffer: false, valueAsBuffer: false, end: new Buffer(0)}), function (err, data) {
+       t.notOk(err, 'no error')
+       t.equal(data.length, 100, 'correct number of entries')
+       var expected = sourceData.map(transformSource)
+       t.deepEqual(data, expected)
+       t.end()
+     })
+   })
  }
  
  module.exports.tearDown = function () {

-- 
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