Skip to content

Commit 8ae1f84

Browse files
committed
Add spec for Thread.list under concurrent load
1 parent 2ef87ec commit 8ae1f84

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

spec/ruby/core/thread/list_spec.rb

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,21 @@
3535
t.join
3636
end
3737
end
38-
end
3938

40-
describe "Thread.list" do
41-
it "needs to be reviewed for spec completeness"
39+
it "returns instances of Thread and not null or nil values" do
40+
spawner = Thread.new do
41+
Array.new(100) do
42+
Thread.new {}
43+
end
44+
end
45+
46+
while spawner.alive?
47+
Thread.list.each { |th|
48+
th.should be_kind_of(Thread)
49+
}
50+
end
51+
52+
threads = spawner.value
53+
threads.each(&:join)
54+
end
4255
end

0 commit comments

Comments
 (0)