зеркало из https://github.com/github/ruby.git
* lib/thread.rb (Queue#push): return self.
* lib/thread.rb (Queue#clear): ditto. * lib/thread.rb (SizedQueue#push): ditto. * test/thread/test_queue.rb: add tests for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
0b1ff93945
Коммит
1c47bd88c1
|
@ -1,3 +1,10 @@
|
|||
Thu Mar 7 10:42:28 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* lib/thread.rb (Queue#push): return self.
|
||||
* lib/thread.rb (Queue#clear): ditto.
|
||||
* lib/thread.rb (SizedQueue#push): ditto.
|
||||
* test/thread/test_queue.rb: add tests for the above.
|
||||
|
||||
Thu Mar 7 10:40:49 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* tool/change_maker.rb (#diff2index): check Encoding::BINARY.
|
||||
|
|
|
@ -165,6 +165,7 @@ class Queue
|
|||
@que.push obj
|
||||
@cond.signal
|
||||
end
|
||||
self
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -228,6 +229,7 @@ class Queue
|
|||
#
|
||||
def clear
|
||||
@que.clear
|
||||
self
|
||||
end
|
||||
|
||||
#
|
||||
|
@ -315,6 +317,7 @@ class SizedQueue < Queue
|
|||
@que.push obj
|
||||
@cond.signal
|
||||
end
|
||||
self
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -108,4 +108,29 @@ class TestQueue < Test::Unit::TestCase
|
|||
end
|
||||
}
|
||||
end
|
||||
|
||||
def test_queue_push_return_value
|
||||
q = Queue.new
|
||||
retval = q.push(1)
|
||||
assert_same q, retval
|
||||
end
|
||||
|
||||
def test_queue_clear_return_value
|
||||
q = Queue.new
|
||||
retval = q.clear
|
||||
assert_same q, retval
|
||||
end
|
||||
|
||||
def test_sized_queue_push_return_value
|
||||
q = SizedQueue.new(1)
|
||||
retval = q.push(1)
|
||||
assert_same q, retval
|
||||
end
|
||||
|
||||
def test_sized_queue_clear_return_value
|
||||
q = SizedQueue.new(1)
|
||||
retval = q.clear
|
||||
assert_same q, retval
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче