1 # frozen_string_literal: false
3 # test Win32OLE avoids cfp consistency error when the exception raised
4 # in WIN32OLE::Event handler block. [ruby-dev:35450]
16 class TestErrInCallBack < Test::Unit::TestCase
19 if File.exist?("./" + CONFIG["RUBY_INSTALL_NAME"] + CONFIG["EXEEXT"])
20 sep = File::ALT_SEPARATOR || "/"
21 @ruby = "." + sep + CONFIG["RUBY_INSTALL_NAME"]
22 cwd = Pathname.new(File.expand_path('.'))
24 " -I " + (Pathname.new(e).relative_path_from(cwd).to_s rescue e)
26 script = File.join(File.dirname(__FILE__), "err_in_callback.rb")
27 @script = Pathname.new(script).relative_path_from(cwd).to_s rescue script
33 WIN32OLE.new('ADODB.Connection')
34 rescue WIN32OLE::RuntimeError
40 def test_err_in_callback
41 omit "'ADODB.Connection' is not available" unless available_adodb?
43 Dir.mktmpdir do |tmpdir|
44 logfile = File.join(tmpdir, "test_err_in_callback.log")
45 cmd = "#{@ruby} -v #{@iopt} #{@script} > #{logfile.gsub(%r(/), '\\')} 2>&1"
51 assert_match(/NameError/, str)