зеркало из https://github.com/github/ruby.git
test_scanf.rb: use tmpefile
* test/scanf/test_scanf.rb (TestIOScanf): use different name for each tests, to get rid of weird errors on Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
cc216f9aae
Коммит
fe38078910
|
@ -7,7 +7,7 @@
|
|||
|
||||
require 'scanf.rb'
|
||||
require 'test/unit'
|
||||
require 'tmpdir'
|
||||
require 'tempfile'
|
||||
|
||||
# Comment out either of these lines to skip those tests.
|
||||
|
||||
|
@ -311,15 +311,13 @@ class TestIOScanf
|
|||
include Scanf
|
||||
extend ScanfTests
|
||||
|
||||
tmpfilename = "#{Dir.tmpdir}/iotest.dat.#{$$}"
|
||||
|
||||
self.each_test do |test, i|
|
||||
define_method("test_#{i}") do ||
|
||||
File.open(tmpfilename, "w") {|fh| fh.print test[1]}
|
||||
File.open(tmpfilename, "r") { |fh|
|
||||
Tempfile.create("iotest.dat") do |fh|
|
||||
fh.print test[1]
|
||||
fh.rewind
|
||||
assert_equal(test[2], fh.scanf(test[0]))
|
||||
}
|
||||
File.delete(tmpfilename)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче