зеркало из https://github.com/github/ruby.git
Get rid of toplevel methods
This commit is contained in:
Родитель
93c9405e0e
Коммит
e0a3c547dd
|
@ -5,8 +5,7 @@ rescue LoadError
|
||||||
end
|
end
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
|
|
||||||
def ado_installed?
|
ado_installed =
|
||||||
installed = false
|
|
||||||
if defined?(WIN32OLE)
|
if defined?(WIN32OLE)
|
||||||
db = nil
|
db = nil
|
||||||
begin
|
begin
|
||||||
|
@ -15,24 +14,19 @@ def ado_installed?
|
||||||
db.open
|
db.open
|
||||||
db.close
|
db.close
|
||||||
db = nil
|
db = nil
|
||||||
installed = true
|
true
|
||||||
rescue
|
rescue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
installed
|
|
||||||
end
|
|
||||||
|
|
||||||
def swbemsink_available?
|
swbemsink_available =
|
||||||
available = false
|
|
||||||
if defined?(WIN32OLE)
|
if defined?(WIN32OLE)
|
||||||
begin
|
begin
|
||||||
WIN32OLE.new('WbemScripting.SWbemSink')
|
WIN32OLE.new('WbemScripting.SWbemSink')
|
||||||
available = true
|
true
|
||||||
rescue
|
rescue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
available
|
|
||||||
end
|
|
||||||
|
|
||||||
if defined?(WIN32OLE_EVENT)
|
if defined?(WIN32OLE_EVENT)
|
||||||
class TestWIN32OLE_EVENT < Test::Unit::TestCase
|
class TestWIN32OLE_EVENT < Test::Unit::TestCase
|
||||||
|
@ -49,12 +43,8 @@ if defined?(WIN32OLE_EVENT)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class TestWIN32OLE_EVENT_SWbemSink < Test::Unit::TestCase
|
if swbemsink_available
|
||||||
unless swbemsink_available?
|
class TestWIN32OLE_EVENT_SWbemSink < Test::Unit::TestCase
|
||||||
def test_dummy_for_skip_message
|
|
||||||
skip "'WbemScripting.SWbemSink' is not available"
|
|
||||||
end
|
|
||||||
else
|
|
||||||
def setup
|
def setup
|
||||||
@wmi = WIN32OLE.connect('winmgmts://localhost/root/cimv2')
|
@wmi = WIN32OLE.connect('winmgmts://localhost/root/cimv2')
|
||||||
@sws = WIN32OLE.new('WbemScripting.SWbemSink')
|
@sws = WIN32OLE.new('WbemScripting.SWbemSink')
|
||||||
|
@ -166,12 +156,8 @@ if defined?(WIN32OLE_EVENT)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class TestWIN32OLE_EVENT_ADO < Test::Unit::TestCase
|
if ado_installed
|
||||||
unless ado_installed?
|
class TestWIN32OLE_EVENT_ADO < Test::Unit::TestCase
|
||||||
def test_dummy_for_skip_message
|
|
||||||
skip "ActiveX Data Object Library not found"
|
|
||||||
end
|
|
||||||
else
|
|
||||||
CONNSTR="Driver={Microsoft Text Driver (*.txt; *.csv)};DefaultDir=.;"
|
CONNSTR="Driver={Microsoft Text Driver (*.txt; *.csv)};DefaultDir=.;"
|
||||||
module ADO
|
module ADO
|
||||||
end
|
end
|
||||||
|
|
Загрузка…
Ссылка в новой задаче