aboutsummaryrefslogtreecommitdiffstats
path: root/test/scanf
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-27 08:19:46 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-27 08:19:46 +0000
commitfe380789101b80574e62250f16ed3f1e3acf782b (patch)
tree803f7bdff004f0239f767f68a0d5e00b4350c1b2 /test/scanf
parentcc216f9aae241c2a4407a1d8253909b307df90bb (diff)
downloadruby-fe380789101b80574e62250f16ed3f1e3acf782b.tar.gz
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
Diffstat (limited to 'test/scanf')
-rw-r--r--test/scanf/test_scanf.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/test/scanf/test_scanf.rb b/test/scanf/test_scanf.rb
index 84d8788ae1..3f09b1d330 100644
--- a/test/scanf/test_scanf.rb
+++ b/test/scanf/test_scanf.rb
@@ -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