Permalink
Browse files

Fix incorrect testing of `Array#each` on sparse arrays.

  • Loading branch information...
1 parent c9ee1c4 commit 43adb8b4ecabc6855324e07111c3fad6627861ea @savetheclocktower savetheclocktower committed Feb 18, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 test/unit/array_test.js
View
@@ -216,9 +216,13 @@ new Test.Unit.Runner({
},
testEachOnSparseArrays: function() {
+ var counter = 0;
+
var sparseArray = [0, 1];
sparseArray[5] = 5;
- this.assertEqual('[0, 1, 5]', sparseArray.inspect(), "Array#each should skip nonexistent keys in an array");
+ sparseArray.each( function(item) { counter++; });
+
+ this.assertEqual(3, counter, "Array#each should skip nonexistent keys in an array");
},
testMapGeneric: function() {

0 comments on commit 43adb8b

Please sign in to comment.