mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
refactoring define AvailableOLE.sysmon_available?
* test/win32ole/test_win32ole_type_event.rb: refactoring. use AvailableOLE.sysmon_available? * test/win32ole/available_ole.rb: define AvailableOLE.sysmon_available? git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
39a840d084
commit
2fe69b221c
2 changed files with 19 additions and 7 deletions
17
test/win32ole/available_ole.rb
Normal file
17
test/win32ole/available_ole.rb
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
begin
|
||||||
|
require 'win32ole'
|
||||||
|
rescue LoadError
|
||||||
|
end
|
||||||
|
|
||||||
|
if defined?(WIN32OLE)
|
||||||
|
module AvailableOLE
|
||||||
|
module_function
|
||||||
|
|
||||||
|
def sysmon_available?
|
||||||
|
WIN32OLE_TYPE.new('System Monitor Control', 'SystemMonitor')
|
||||||
|
true
|
||||||
|
rescue
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -7,15 +7,10 @@ end
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
|
|
||||||
if defined?(WIN32OLE_TYPE)
|
if defined?(WIN32OLE_TYPE)
|
||||||
def sysmon_available?
|
require_relative 'available_ole'
|
||||||
WIN32OLE_TYPE.new('System Monitor Control', 'SystemMonitor')
|
|
||||||
true
|
|
||||||
rescue
|
|
||||||
false
|
|
||||||
end
|
|
||||||
|
|
||||||
class TestWIN32OLE_TYPE_EVENT < Test::Unit::TestCase
|
class TestWIN32OLE_TYPE_EVENT < Test::Unit::TestCase
|
||||||
unless sysmon_available?
|
unless AvailableOLE.sysmon_available?
|
||||||
def test_dummy_for_skip_message
|
def test_dummy_for_skip_message
|
||||||
skip 'System Monitor Control is not available'
|
skip 'System Monitor Control is not available'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue