[前][次][番号順一覧][スレッド一覧]

ruby-changes:15570

From: akr <ko1@a...>
Date: Sat, 24 Apr 2010 21:08:09 +0900 (JST)
Subject: [ruby-changes:15570] Ruby:r27476 (trunk): * test/psych/test_psych.rb: don't leave temporary files.

akr	2010-04-24 21:07:53 +0900 (Sat, 24 Apr 2010)

  New Revision: 27476

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27476

  Log:
    * test/psych/test_psych.rb: don't leave temporary files.

  Modified files:
    trunk/ChangeLog
    trunk/test/psych/test_psych.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 27475)
+++ ChangeLog	(revision 27476)
@@ -1,3 +1,7 @@
+Sat Apr 24 21:07:27 2010  Tanaka Akira  <akr@f...>
+
+	* test/psych/test_psych.rb: don't leave temporary files.
+
 Sat Apr 24 16:27:48 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* Makefile.in (RUBY_PROGRAM_VERSION): added
Index: test/psych/test_psych.rb
===================================================================
--- test/psych/test_psych.rb	(revision 27475)
+++ test/psych/test_psych.rb	(revision 27476)
@@ -83,17 +83,21 @@
   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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]