diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-28 16:51:41 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-28 16:51:41 +0000 |
| commit | a705017bd1e1190ccbf975fac631f313645f7fa8 (patch) | |
| tree | f86ea8a92bf4dcf23b500dff988e8225aed8177a /test/scanf/test_scanf.rb | |
| parent | fcf498a543a3d39cf3fef04bee29176ba14acb61 (diff) | |
| download | ruby-a705017bd1e1190ccbf975fac631f313645f7fa8.tar.gz ruby-a705017bd1e1190ccbf975fac631f313645f7fa8.tar.xz ruby-a705017bd1e1190ccbf975fac631f313645f7fa8.zip | |
don't generate temporary files under current directory.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/scanf/test_scanf.rb')
| -rw-r--r-- | test/scanf/test_scanf.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/scanf/test_scanf.rb b/test/scanf/test_scanf.rb index 26ec3474e..2890a3a03 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 |
