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

ruby-changes:49072

From: eregon <ko1@a...>
Date: Wed, 13 Dec 2017 03:52:02 +0900 (JST)
Subject: [ruby-changes:49072] eregon:r61186 (trunk): Fix tests which fail with extra stderr output when a Thread dies

eregon	2017-12-13 03:44:21 +0900 (Wed, 13 Dec 2017)

  New Revision: 61186

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

  Log:
    Fix tests which fail with extra stderr output when a Thread dies
    
    * [Feature #14143] [ruby-core:83979].

  Modified files:
    trunk/test/digest/test_digest.rb
    trunk/test/ruby/test_io.rb
Index: test/ruby/test_io.rb
===================================================================
--- test/ruby/test_io.rb	(revision 61185)
+++ test/ruby/test_io.rb	(revision 61186)
@@ -2911,11 +2911,15 @@ __END__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L2911
         $stdin.reopen(r)
         r.close
         read_thread = Thread.new do
-          $stdin.read(1)
+          begin
+            $stdin.read(1)
+          rescue IOError => e
+            e
+          end
         end
         sleep(0.1) until read_thread.stop?
         $stdin.close
-        assert_raise(IOError) {read_thread.join}
+        assert_kind_of(IOError, read_thread.value)
       end
     end;
   end
@@ -3539,7 +3543,9 @@ __END__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L3543
         thread = Thread.new do
           begin
             q << true
-            while r.gets
+            assert_raise_with_message(IOError, /stream closed/) do
+              while r.gets
+              end
             end
           ensure
             closed = r.closed?
@@ -3548,9 +3554,7 @@ __END__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L3554
         q.pop
         sleep 0.01 until thread.stop?
         r.close
-        assert_raise_with_message(IOError, /stream closed/) do
-          thread.join
-        end
+        thread.join
         assert_equal(true, closed, bug13158 + ': stream should be closed')
       end
     end;
Index: test/digest/test_digest.rb
===================================================================
--- test/digest/test_digest.rb	(revision 61185)
+++ test/digest/test_digest.rb	(revision 61186)
@@ -264,6 +264,7 @@ module TestDigest https://github.com/ruby/ruby/blob/trunk/test/digest/test_digest.rb#L264
         assert_nothing_raised {
           t = Thread.start {
             sleep 0.1
+            Thread.current.report_on_exception = false
             Digest::Foo.new
           }
           Digest(:Foo).new

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

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