From 15689ed7780b06ddc14cde4f427de834177283a5 Mon Sep 17 00:00:00 2001 From: eregon Date: Tue, 12 Dec 2017 18:44:49 +0000 Subject: 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 --- test/thread/test_cv.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'test/thread/test_cv.rb') diff --git a/test/thread/test_cv.rb b/test/thread/test_cv.rb index 702462606d..1e15d2e9ec 100644 --- a/test/thread/test_cv.rb +++ b/test/thread/test_cv.rb @@ -42,12 +42,10 @@ class TestConditionVariable < Test::Unit::TestCase thread = Thread.new do Thread.current.abort_on_exception = false mutex.synchronize do - begin + assert_raise(Interrupt) { condvar.wait(mutex) - rescue Exception - locked = mutex.locked? - raise - end + } + locked = mutex.locked? end end @@ -56,7 +54,7 @@ class TestConditionVariable < Test::Unit::TestCase end thread.raise Interrupt, "interrupt a dead condition variable" - assert_raise(Interrupt) { thread.value } + thread.join assert(locked) end -- cgit v1.2.3