Skip to content

Commit

Permalink
Missinge changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyksv committed Sep 9, 2015
1 parent 88a6a62 commit 6a1db6a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/finder.js
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ var ops = {
}
this.native3 = function () {
var match = this._args[1].native();
match = match.replace(/\/+/g, "\\/").replace(/\\\\/g,"\\").replace(/\"/g,"/");
match = match.replace(/\/+/g, "\\/").replace(/\\\\/g,"\\").replace(/^\"/,"/").replace(/\"$/,"/");
var opts = this._args.length>2?this._args[2].native():'';
opts = opts.replace(/\"/g,"");
var s = "(function () {\n";
Expand Down
23 changes: 12 additions & 11 deletions test/misc-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,15 @@ describe('Misc', function () {
_coll.find({hello: /^\.$/}).toArray(safe.sure(done, function(items) {
assert.equal(items.length,1);
assert.equal('.', items[0].hello); //normally escaped works
done()
}))
}))
}))
}))
})
it('regexp with double quote', function (done) {
db.collection("doublequote", {}, safe.sure(done,function (_coll) {
done();
}));
}));
}));
}));
});

it('regexp with double quotes', function (done) {
db.collection("doublequotes", {}, safe.sure(done,function (_coll) {
_coll.insert([{hello:'"quote"'}, {hello:'""'}], {w:1}, safe.sure(done, function(result) {
_coll.find({hello: new RegExp('^".*"$')}).toArray(safe.sure(done, function(items) {
assert.equal(items.length,2);
Expand All @@ -131,7 +132,7 @@ describe('Misc', function () {
done();
}));
}));
}))
}))
})
}));
}));
});
});

0 comments on commit 6a1db6a

Please sign in to comment.