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

ruby-changes:36301

From: akr <ko1@a...>
Date: Tue, 11 Nov 2014 23:44:27 +0900 (JST)
Subject: [ruby-changes:36301] akr:r48382 (trunk): * test/fileutils/test_fileutils.rb: Use assert_join_threads.

akr	2014-11-11 23:44:18 +0900 (Tue, 11 Nov 2014)

  New Revision: 48382

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

  Log:
    * test/fileutils/test_fileutils.rb: Use assert_join_threads.

  Modified files:
    trunk/ChangeLog
    trunk/test/fileutils/test_fileutils.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48381)
+++ ChangeLog	(revision 48382)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Nov 11 23:43:51 2014  Tanaka Akira  <akr@f...>
+
+	* test/fileutils/test_fileutils.rb: Use assert_join_threads.
+
 Tue Nov 11 22:51:14 2014  Tanaka Akira  <akr@f...>
 
 	* test/resolv/test_dns.rb: Use assert_join_threads.
Index: test/fileutils/test_fileutils.rb
===================================================================
--- test/fileutils/test_fileutils.rb	(revision 48381)
+++ test/fileutils/test_fileutils.rb	(revision 48382)
@@ -6,6 +6,7 @@ require_relative 'fileasserts' https://github.com/ruby/ruby/blob/trunk/test/fileutils/test_fileutils.rb#L6
 require 'pathname'
 require 'tmpdir'
 require 'test/unit'
+require_relative '../ruby/envutil'
 
 class TestFileUtils < Test::Unit::TestCase
   TMPROOT = "#{Dir.tmpdir}/fileutils.rb.#{$$}"
@@ -16,11 +17,12 @@ class TestFileUtils < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/fileutils/test_fileutils.rb#L17
     IO.pipe {|read, write|
       fu.instance_variable_set(:@fileutils_output, write)
       th = Thread.new { read.read }
-
-      yield
-
-      write.close
-      lines = th.value.lines.map {|l| l.chomp }
+      th2 = Thread.new {
+        yield
+        write.close
+      }
+      th_value, _ = assert_join_threads([th, th2])
+      lines = th_value.lines.map {|l| l.chomp }
       assert_equal(expected, lines)
     }
   ensure

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

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