diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-18 05:47:37 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-18 05:47:37 +0000 |
commit | ac454412abff3e4ba084c987802f61dcc4914dae (patch) | |
tree | 78e3d6c742620fc3750074fa370b2108a89fb50b /test/win32ole | |
parent | aa24857f12718d1fa81d77695f6f5af319334d24 (diff) | |
download | ruby-ac454412abff3e4ba084c987802f61dcc4914dae.tar.gz |
* test/win32ole/test_err_in_callback.rb
(TestErrInCallBack#test_err_in_callback): shouldn't create a file in
source directory.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/win32ole')
-rw-r--r-- | test/win32ole/test_err_in_callback.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/test/win32ole/test_err_in_callback.rb b/test/win32ole/test_err_in_callback.rb index 11c29a8d77..395173d82c 100644 --- a/test/win32ole/test_err_in_callback.rb +++ b/test/win32ole/test_err_in_callback.rb @@ -10,6 +10,7 @@ end 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) 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 |