Skip to content

Commit

Permalink
zip test passes
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Sep 9, 2010
1 parent 616514e commit 0226636
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,17 @@ exports.compact = function (assert) {
assert.equal(compacted.items.e.join(' '), hash.e.join(' '));
assert.equal(compacted.items.f, hash.f);
};

exports.zip = function (assert) {
var xs = ['a','b','c'];
var ys = [1,2,3,4];
var h = Hash(xs,ys);
assert.equal(h.length, 3);
assert.equal(h.keys.sort().join(' '), 'a b c');
assert.equal(h.items.a, 1);
assert.equal(h.items.b, 2);
assert.equal(h.items.c, 3);
assert.equal(ys.join(' '), '1 2 3 4');
h.items.b += 10;
assert.equal(h.valuesAt(['b'])[0], 12);
};

0 comments on commit 0226636

Please sign in to comment.