1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

ext/win32ole/lib/win32ole.rb (metods): rescue WIN32OLEQueryInterfaceError.

test/win32ole/test_win32ole.rb: add test for WIN32OLE#methods


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
suke 2017-11-05 01:02:04 +00:00
parent 62cec32902
commit 6bac2765a7
2 changed files with 18 additions and 5 deletions

View file

@ -19,7 +19,15 @@ if defined?(WIN32OLE)
# #=> Did you mean? Add
#
def methods(*args)
super + ole_methods.map(&:name)
super + ole_methods_safely.map(&:name)
end
private
def ole_methods_safely
ole_methods
rescue WIN32OLEQueryInterfaceError
[]
end
end
end

View file

@ -69,7 +69,12 @@ if defined?(WIN32OLE)
mnames = methods.collect {|m|
m.name
}
assert(mnames.include?("Add"))
assert_include(mnames, 'Add')
end
def test_methods
methods = @dict1.methods
assert_include(methods, 'Add')
end
def test_ole_func_methods
@ -77,7 +82,7 @@ if defined?(WIN32OLE)
mnames = methods.collect {|m|
m.name
}
assert(mnames.include?("Add"))
assert_include(mnames, 'Add')
end
def test_ole_put_methods
@ -85,7 +90,7 @@ if defined?(WIN32OLE)
mnames = methods.collect {|m|
m.name
}
assert(mnames.include?("CompareMode"))
assert_include(mnames, 'CompareMode')
end
def test_ole_get_methods
@ -93,7 +98,7 @@ if defined?(WIN32OLE)
mnames = methods.collect {|m|
m.name
}
assert(mnames.include?("Count"))
assert_include(mnames, 'Count')
end
def test_ole_mehtod_help