Skip to content

Commit

Permalink
Added a test for ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
agile authored and agile committed Jul 16, 2012
1 parent 65ac74a commit 3dd7b89
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -2,4 +2,5 @@
*.iml
node_modules/
.DS_Store
npm-debug.log
npm-debug.log
*~
8 changes: 4 additions & 4 deletions lib/boneidle.iterators.js
Expand Up @@ -166,11 +166,11 @@ function FilterIterator(iterator, predicate) {

function RangeIterator(from, to) {
var i = from;
this.hasNext = function () {
return i <= to;
this.hasNext = function (callback) {
callback(i <= to);
}
this.next = function () {
return i++;
this.next = function (callback) {
callback(i++);
}
}

Expand Down
10 changes: 10 additions & 0 deletions test/range_tests.js
@@ -0,0 +1,10 @@
var b_ = require("./../lib/boneidle");

module.exports = {
"Realise on a range returns those numbers":function (test) {
b_.range(1, 5).realise(function (value) {
test.same(value, [1, 2, 3, 4, 5]);
test.done()
});
}
};

0 comments on commit 3dd7b89

Please sign in to comment.