diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-27 08:19:46 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-27 08:19:46 +0000 |
commit | fe380789101b80574e62250f16ed3f1e3acf782b (patch) | |
tree | 803f7bdff004f0239f767f68a0d5e00b4350c1b2 /test | |
parent | cc216f9aae241c2a4407a1d8253909b307df90bb (diff) |
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')
-rw-r--r-- | test/scanf/test_scanf.rb | 12 |
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 |