mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_queue.rb: non-blocking pop tests
* test/thread/test_queue.rb (test_queue_pop_non_block): test for non-blocking pop. * test/thread/test_queue.rb (test_sized_queue_pop_non_block): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
25a2e870d4
commit
06e70ae4f3
1 changed files with 14 additions and 0 deletions
|
@ -74,6 +74,13 @@ class TestQueue < Test::Unit::TestCase
|
|||
assert_equal(0, q.num_waiting)
|
||||
end
|
||||
|
||||
def test_queue_pop_non_block
|
||||
q = Queue.new
|
||||
assert_raise_with_message(ThreadError, /empty/) do
|
||||
q.pop(true)
|
||||
end
|
||||
end
|
||||
|
||||
def test_sized_queue_pop_interrupt
|
||||
q = SizedQueue.new(1)
|
||||
t1 = Thread.new { q.pop }
|
||||
|
@ -82,6 +89,13 @@ class TestQueue < Test::Unit::TestCase
|
|||
assert_equal(0, q.num_waiting)
|
||||
end
|
||||
|
||||
def test_sized_queue_pop_non_block
|
||||
q = SizedQueue.new(1)
|
||||
assert_raise_with_message(ThreadError, /empty/) do
|
||||
q.pop(true)
|
||||
end
|
||||
end
|
||||
|
||||
def test_sized_queue_push_interrupt
|
||||
q = SizedQueue.new(1)
|
||||
q.push(1)
|
||||
|
|
Loading…
Add table
Reference in a new issue