summaryrefslogtreecommitdiffstats
path: root/test/scanf
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-28 18:22:23 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-28 18:22:23 +0000
commitf43ee44a4d6c56f538bb8c34f1138fb487b26e43 (patch)
treec5a7e0786508c6cad0054210fb2a35cd47e2fc1e /test/scanf
parenta705017bd1e1190ccbf975fac631f313645f7fa8 (diff)
downloadruby-f43ee44a4d6c56f538bb8c34f1138fb487b26e43.tar.gz
ruby-f43ee44a4d6c56f538bb8c34f1138fb487b26e43.tar.xz
ruby-f43ee44a4d6c56f538bb8c34f1138fb487b26e43.zip
refine previous change.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/scanf')
-rw-r--r--test/scanf/test_scanf.rb2
-rw-r--r--test/scanf/test_scanfblocks.rb16
2 files changed, 10 insertions, 8 deletions
diff --git a/test/scanf/test_scanf.rb b/test/scanf/test_scanf.rb
index 2890a3a03..d2e7aa988 100644
--- a/test/scanf/test_scanf.rb
+++ b/test/scanf/test_scanf.rb
@@ -297,7 +297,7 @@ class TestIOScanf
include Scanf
extend ScanfTests
- tmpfilename = "#{Dir.tmpdir}/iotest.dat"
+ tmpfilename = "#{Dir.tmpdir}/iotest.dat.#{$$}"
i = 1
self.tests.each do |test|
diff --git a/test/scanf/test_scanfblocks.rb b/test/scanf/test_scanfblocks.rb
index 7048ae1bf..907a3c283 100644
--- a/test/scanf/test_scanfblocks.rb
+++ b/test/scanf/test_scanfblocks.rb
@@ -50,8 +50,9 @@ alias set_up setup
end
def test_io1
- File.open("#{Dir.tmpdir}/iotest.dat", "w") { |fh| fh.puts(@str) }
- fh = File.open("#{Dir.tmpdir}/iotest.dat", "rb")
+ fn = "#{Dir.tmpdir}/iotest.dat.#{$$}"
+ File.open(fn, "w") { |fh| fh.puts(@str) }
+ fh = File.open(fn, "rb")
res = fh.scanf("%s%d") { |name, year| "#{name} was born in #{year}." }
assert_equal(
@@ -62,18 +63,19 @@ alias set_up setup
"Brahms was born in 1833." ],res)
fh.close
ensure
- File.delete("#{Dir.tmpdir}/iotest.dat")
- end
+ File.delete(fn)
+ end
def test_io2
- File.open("#{Dir.tmpdir}/iotest.dat", "w").close
- fh = File.open("#{Dir.tmpdir}/iotest.dat","rb")
+ fn = "#{Dir.tmpdir}/iotest.dat.#{$$}"
+ File.open(fn, "w").close
+ fh = File.open(fn,"rb")
assert_equal(fh.scanf("") {}, [])
fh.seek(0)
assert_equal(fh.scanf("%d%f%s") {}, [])
fh.close
ensure
- File.delete("#{Dir.tmpdir}/iotest.dat")
+ File.delete(fn)
end
end