Skip to content

Commit cb08fdc

Browse files
committed
Merge pull request #2088 from francois2metz/ios8_my_lovely_jit
Add failing test for each called too much time in ios8
2 parents 044ba5c + cebf284 commit cb08fdc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/collections.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
deepEqual(answers, ['one', 'two', 'three'], 'iterating over objects works, and ignores the object prototype.');
2424
delete obj.constructor.prototype.four;
2525

26+
// ensure the each function is JITed
27+
_(1000).times(function() { _.each([], function(){}); });
28+
var count = 0;
29+
obj = {1 : 'foo', 2 : 'bar', 3 : 'baz'};
30+
_.each(obj, function(value, key){ count++; });
31+
equal(count, 3, 'the fun should be called only 3 times');
32+
2633
var answer = null;
2734
_.each([1, 2, 3], function(num, index, arr){ if (_.include(arr, num)) answer = true; });
2835
ok(answer, 'can reference the original collection from inside the iterator');

0 commit comments

Comments
 (0)