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

ruby-changes:27757

From: usa <ko1@a...>
Date: Mon, 18 Mar 2013 14:48:05 +0900 (JST)
Subject: [ruby-changes:27757] usa:r39809 (trunk): * test/win32ole/test_err_in_callback.rb

usa	2013-03-18 14:47:37 +0900 (Mon, 18 Mar 2013)

  New Revision: 39809

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

  Log:
    * test/win32ole/test_err_in_callback.rb
      (TestErrInCallBack#test_err_in_callback): shouldn't create a file in
      source directory.

  Modified files:
    trunk/ChangeLog
    trunk/test/win32ole/test_err_in_callback.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39808)
+++ ChangeLog	(revision 39809)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Mar 18 14:46:19 2013  NAKAMURA Usaku  <usa@r...>
+
+	* test/win32ole/test_err_in_callback.rb
+	  (TestErrInCallBack#test_err_in_callback): shouldn't create a file in
+	  source directory.
+
 Mon Mar 18 13:29:52 2013  NARUSE, Yui  <naruse@r...>
 
 	* vm_dump.c (backtrace): on darwin use custom backtrace() to trace
Index: test/win32ole/test_err_in_callback.rb
===================================================================
--- test/win32ole/test_err_in_callback.rb	(revision 39808)
+++ test/win32ole/test_err_in_callback.rb	(revision 39809)
@@ -10,6 +10,7 @@ end https://github.com/ruby/ruby/blob/trunk/test/win32ole/test_err_in_callback.rb#L10
 if defined?(WIN32OLE)
   require 'mkmf'
   require 'test/unit'
+  require 'tmpdir'
   class TestErrInCallBack < Test::Unit::TestCase
     def setup
       @ruby = nil
@@ -35,18 +36,17 @@ if defined?(WIN32OLE) https://github.com/ruby/ruby/blob/trunk/test/win32ole/test_err_in_callback.rb#L36
     def test_err_in_callback
       skip "'ADODB.Connection' is not available" unless available_adodb?
       if @ruby
-        cmd = "#{@ruby} -v #{@iopt} #{@script} > test_err_in_callback.log 2>&1"
-        system(cmd)
-        str = ""
-        open("test_err_in_callback.log") {|ifs|
-          str = ifs.read
-        }
-        assert_match(/NameError/, str)
+        Dir.mktmpdir do |tmpdir|
+          logfile = File.join(tmpdir, "test_err_in_callback.log")
+          cmd = "#{@ruby} -v #{@iopt} #{@script} > #{logfile.gsub(%r(/), '\\')} 2>&1"
+          system(cmd)
+          str = ""
+          open(logfile) {|ifs|
+            str = ifs.read
+          }
+          assert_match(/NameError/, str)
+        end
       end
     end
-
-    def teardown
-      File.unlink("test_err_in_callback.log") if File.exist?("test_err_in_callback.log")
-    end
   end
 end

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

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