Skip to content

Commit

Permalink
tests for update, concat, and merge all pass
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Aug 27, 2010
1 parent 249ec0f commit 7fc4eca
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,25 @@ exports['hash traversal'] = function (assert) {
assert.equal(Hash(ref3).values.sort().join(' '), '2 5 7 leet');

assert.equal(Hash(ref3).length, 4);

assert.equal(
Object.keys(Hash.concat([ ref1, ref2 ])).sort().join(' '),
'a b bar foo'
);

var hash3 = Hash(ref1).clone;
var updated = hash3.update({ c : 3, a : 0 });
assert.equal(updated.keys.sort().join(' '), 'a b c');
assert.equal(updated.items.a, 0);
assert.equal(updated.items.b, 2);
assert.equal(updated.items.c, 3);
assert.equal(Object.keys(hash3.items).sort().join(' '), 'a b c');
assert.equal(hash3.items.a, 0);
assert.equal(hash3.items.b, 2);
assert.equal(hash3.items.c, 3);
assert.equal(Object.keys(ref1).sort().join(' '), 'a b');
assert.equal(ref1.a, 1);
assert.equal(ref1.b, 2);

};

0 comments on commit 7fc4eca

Please sign in to comment.