From 0e5546df901d15381d4ec08af11971c649a7c308 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 24 Apr 2010 12:07:53 +0000 Subject: * test/psych/test_psych.rb: don't leave temporary files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ test/psych/test_psych.rb | 20 ++++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 731e55828f..afe0730f4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sat Apr 24 21:07:27 2010 Tanaka Akira + + * test/psych/test_psych.rb: don't leave temporary files. + Sat Apr 24 16:27:48 2010 Nobuyoshi Nakada * Makefile.in (RUBY_PROGRAM_VERSION): added diff --git a/test/psych/test_psych.rb b/test/psych/test_psych.rb index 78f022c1fb..4f78ea96d9 100644 --- a/test/psych/test_psych.rb +++ b/test/psych/test_psych.rb @@ -83,17 +83,21 @@ class TestPsych < Psych::TestCase end def test_load_file - name = File.join(Dir.tmpdir, 'yikes.yml') - File.open(name, 'wb') { |f| f.write('--- hello world') } - - assert_equal 'hello world', Psych.load_file(name) + t = Tempfile.new(['yikes', 'yml']) + t.binmode + t.write('--- hello world') + t.close + assert_equal 'hello world', Psych.load_file(t.path) + t.close(true) end def test_parse_file - name = File.join(Dir.tmpdir, 'yikes.yml') - File.open(name, 'wb') { |f| f.write('--- hello world') } - - assert_equal 'hello world', Psych.parse_file(name).transform + t = Tempfile.new(['yikes', 'yml']) + t.binmode + t.write('--- hello world') + t.close + assert_equal 'hello world', Psych.parse_file(t.path).transform + t.close(true) end def test_degenerate_strings -- cgit v1.2.3