From a9c2a18cc796fa59d5d696ef9d99d41b1149a242 Mon Sep 17 00:00:00 2001 From: akr Date: Fri, 28 Sep 2007 16:51:41 +0000 Subject: don't generate temporary files under current directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/scanf/test_scanf.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'test/scanf/test_scanf.rb') diff --git a/test/scanf/test_scanf.rb b/test/scanf/test_scanf.rb index 26ec3474e0..2890a3a038 100644 --- a/test/scanf/test_scanf.rb +++ b/test/scanf/test_scanf.rb @@ -7,6 +7,7 @@ require 'scanf.rb' require 'test/unit' +require 'tmpdir' # Comment out either of these lines to skip those tests. @@ -295,15 +296,17 @@ end class TestIOScanf include Scanf extend ScanfTests + + tmpfilename = "#{Dir.tmpdir}/iotest.dat" i = 1 self.tests.each do |test| define_method("test_#{i}") do || - File.open("iotest.dat", "w") {|fh| fh.print test[1]} - File.open("iotest.dat", "r") { |fh| + File.open(tmpfilename, "w") {|fh| fh.print test[1]} + File.open(tmpfilename, "r") { |fh| assert_equal(test[2], fh.scanf(test[0])) } - File.delete("iotest.dat") + File.delete(tmpfilename) end i += 1 end -- cgit v1.2.3