mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/fileutils/test_fileutils.rb: Use assert_join_threads.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
08bb9482a0
commit
801c8ab026
2 changed files with 11 additions and 5 deletions
|
@ -1,3 +1,7 @@
|
|||
Tue Nov 11 23:43:51 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* test/fileutils/test_fileutils.rb: Use assert_join_threads.
|
||||
|
||||
Tue Nov 11 22:51:14 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* test/resolv/test_dns.rb: Use assert_join_threads.
|
||||
|
|
|
@ -6,6 +6,7 @@ require_relative 'fileasserts'
|
|||
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::TestCase
|
|||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue