[前][次][番号順一覧][スレッド一覧]

ruby-changes:34768

From: nobu <ko1@a...>
Date: Thu, 17 Jul 2014 19:57:03 +0900 (JST)
Subject: [ruby-changes:34768] nobu:r46851 (trunk): test_queue.rb: non-blocking pop tests

nobu	2014-07-17 19:56:53 +0900 (Thu, 17 Jul 2014)

  New Revision: 46851

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46851

  Log:
    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.

  Modified files:
    trunk/test/thread/test_queue.rb
Index: test/thread/test_queue.rb
===================================================================
--- test/thread/test_queue.rb	(revision 46850)
+++ test/thread/test_queue.rb	(revision 46851)
@@ -74,6 +74,13 @@ class TestQueue < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/thread/test_queue.rb#L74
     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 https://github.com/ruby/ruby/blob/trunk/test/thread/test_queue.rb#L89
     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)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]