Skip to content

Commit

Permalink
remove tests
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Jun 6, 2011
1 parent 9528471 commit 7010fe2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/mutability.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,22 @@ exports.reduceInit = function () {
assert.deepEqual(obj, { a : 1, b : 2, c : [ 3, 4 ] });
assert.deepEqual(res, obj);
};

exports.remove = function () {
var obj = { a : 1, b : 2, c : [ 3, 4 ] };
Traverse(obj).forEach(function (x) {
if (this.isLeaf && x % 2 == 0) this.remove();
});

assert.deepEqual(obj, { a : 1, c : [ 3 ] });
};

exports.removeMap = function () {
var obj = { a : 1, b : 2, c : [ 3, 4 ] };
var res = Traverse(obj).map(function (x) {
if (this.isLeaf && x % 2 == 0) this.remove();
});

assert.deepEqual(obj, { a : 1, b : 2, c : [ 3, 4 ] });
assert.deepEqual(res, { a : 1, c : [ 3 ] });
};

0 comments on commit 7010fe2

Please sign in to comment.