Skip to content

Commit 95723d8

Browse files
committed
Fix nil size Enumerator test
If the `size` is `nil`, which means the size is unknown: 1. Test with loop but break after 10,000 loops. 2. If the object has more than 10,000 objects, assume it’s an infinite loop. This is clearly broken for enumerators with more than 10,000 but fixed size. But it works for tests.
1 parent 3d0fb3a commit 95723d8

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

lib/rbs/test/type_check.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,19 @@ def value(val, type)
288288
values << args
289289
nil
290290
end
291+
when nil
292+
values = []
293+
count = 10_000
294+
295+
ret = val.each do |*args|
296+
count -= 1
297+
values << args
298+
break if count <= 0
299+
end
300+
301+
if count == 0
302+
ret = self
303+
end
291304
else
292305
values = []
293306
ret = val.each do |*args|

0 commit comments

Comments
 (0)