summaryrefslogtreecommitdiff
path: root/test/rinda/test_rinda.rb
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-12 18:44:49 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-12 18:44:49 +0000
commit15689ed7780b06ddc14cde4f427de834177283a5 (patch)
treebed64f4fdaf3e1a140642bdd0354384ae286759c /test/rinda/test_rinda.rb
parent967eab83e333430600926366621aa3a978701c6a (diff)
Fix test-all tests to avoid creating report_on_exception warnings
* The warnings are shown by Thread.report_on_exception defaulting to true. [Feature #14143] [ruby-core:83979] * Improves tests by narrowing down the scope where an exception is expected. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rinda/test_rinda.rb')
-rw-r--r--test/rinda/test_rinda.rb54
1 files changed, 28 insertions, 26 deletions
diff --git a/test/rinda/test_rinda.rb b/test/rinda/test_rinda.rb
index 9874e32872..c899f32a8a 100644
--- a/test/rinda/test_rinda.rb
+++ b/test/rinda/test_rinda.rb
@@ -241,17 +241,21 @@ module TupleSpaceTestModule
end
def test_ruby_talk_264062
- th = Thread.new { @ts.take([:empty], 1) }
+ th = Thread.new {
+ assert_raise(Rinda::RequestExpiredError) do
+ @ts.take([:empty], 1)
+ end
+ }
sleep(10)
- assert_raise(Rinda::RequestExpiredError) do
- thread_join(th)
- end
+ thread_join(th)
- th = Thread.new { @ts.read([:empty], 1) }
+ th = Thread.new {
+ assert_raise(Rinda::RequestExpiredError) do
+ @ts.read([:empty], 1)
+ end
+ }
sleep(10)
- assert_raise(Rinda::RequestExpiredError) do
- thread_join(th)
- end
+ thread_join(th)
end
def test_symbol_tuple
@@ -348,19 +352,18 @@ module TupleSpaceTestModule
template = nil
taker = Thread.new do
- @ts.take([:take, nil], 10) do |t|
- template = t
- Thread.new do
- template.cancel
- end
+ assert_raise(Rinda::RequestCanceledError) do
+ @ts.take([:take, nil], 10) do |t|
+ template = t
+ Thread.new do
+ template.cancel
+ end
+ end
end
end
sleep(2)
-
- assert_raise(Rinda::RequestCanceledError) do
- thread_join(taker)
- end
+ thread_join(taker)
assert(template.canceled?)
@@ -377,19 +380,18 @@ module TupleSpaceTestModule
template = nil
reader = Thread.new do
- @ts.read([:take, nil], 10) do |t|
- template = t
- Thread.new do
- template.cancel
- end
+ assert_raise(Rinda::RequestCanceledError) do
+ @ts.read([:take, nil], 10) do |t|
+ template = t
+ Thread.new do
+ template.cancel
+ end
+ end
end
end
sleep(2)
-
- assert_raise(Rinda::RequestCanceledError) do
- thread_join(reader)
- end
+ thread_join(reader)
assert(template.canceled?)