diff options
Diffstat (limited to 'test/rinda')
-rw-r--r-- | test/rinda/test_rinda.rb | 54 |
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?) |