Skip to content

Commit 00470da

Browse files
committed
add a test to ensure that the Hash.each interator function in passed the index parameter
1 parent ecacc02 commit 00470da

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/unit/hash_test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,15 @@ new Test.Unit.Runner({
182182
var foo = new FooMaker('bar');
183183
this.assertEqual("key=bar", new Hash(foo).toQueryString());
184184
this.assertEqual("key=bar", new Hash(new Hash(foo)).toQueryString());
185+
},
186+
187+
testIterationWithEach: function() {
188+
var h = $H({a:1, b:2});
189+
var result = []
190+
h.each(function(kv, i){
191+
result.push(i);
192+
});
193+
this.assertEnumEqual([0,1], result);
185194
}
186195

187196
});

0 commit comments

Comments
 (0)