[ruby/win32ole] Test constants for the backward compatibility

https://github.com/ruby/win32ole/commit/22facf50fd
This commit is contained in:
Nobuyoshi Nakada 2024-03-23 19:07:46 +09:00 committed by git
parent 401251979b
commit a8075caa4e
10 changed files with 43 additions and 0 deletions

View File

@ -167,6 +167,11 @@ if defined?(WIN32OLE)
assert_instance_of(WIN32OLE, @dict2)
end
def test_toplevel_constants_backward_compatibility
assert_equal(WIN32OLE::RuntimeError, ::WIN32OLERuntimeError)
assert_equal(WIN32OLE::QueryInterfaceError, ::WIN32OLEQueryInterfaceError)
end
def test_s_new_exc
assert_raise(TypeError) {
WIN32OLE.new(1)

View File

@ -30,6 +30,10 @@ swbemsink_available =
if defined?(WIN32OLE::Event)
class TestWIN32OLE_EVENT < Test::Unit::TestCase
def test_toplevel_constants_backward_compatibility
assert_equal(WIN32OLE::Event, ::WIN32OLE_EVENT)
end
def test_s_new_exception
assert_raise(TypeError) {
WIN32OLE::Event.new("A")

View File

@ -20,6 +20,10 @@ if defined?(WIN32OLE::Method)
@m_file_name = WIN32OLE::Method.new(ole_type, "name")
end
def test_toplevel_constants_backward_compatibility
assert_equal(WIN32OLE::Method, ::WIN32OLE_METHOD)
end
def test_initialize
ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell")
assert_raise(TypeError) {

View File

@ -27,6 +27,10 @@ if defined?(WIN32OLE::Param)
@param_key = m_add.params[0]
end
def test_constants_backward_compatibility
assert_equal(WIN32OLE::Param, ::WIN32OLE_PARAM)
end
def test_s_new
assert_raise(ArgumentError) {
WIN32OLE::Param.new("hoge")

View File

@ -66,6 +66,12 @@ End Class
if defined?(WIN32OLE::Record)
class TestWIN32OLE_RECORD < Test::Unit::TestCase
def test_toplevel_constants_backward_compatibility
assert_equal(WIN32OLE::Record, ::WIN32OLE_RECORD)
end
end
def rbcomtest_exist?
WIN32OLE.new(PROGID_RBCOMTEST)
true

View File

@ -7,6 +7,9 @@ require "test/unit"
if defined?(WIN32OLE::Type)
class TestWIN32OLE_TYPE < Test::Unit::TestCase
def test_toplevel_constants_backward_compatibility
assert_equal(WIN32OLE::Type, ::WIN32OLE_TYPE)
end
def test_s_progids
progids = WIN32OLE::Type.progids

View File

@ -7,6 +7,10 @@ require "test/unit"
if defined?(WIN32OLE::TypeLib)
class TestWIN32OLE_TYPELIB < Test::Unit::TestCase
def test_toplevel_constants_backward_compatibility
assert_equal(WIN32OLE::TypeLib, ::WIN32OLE_TYPELIB)
end
def test_s_typelibs
tlibs = WIN32OLE::TypeLib.typelibs
assert_instance_of(Array, tlibs)

View File

@ -16,6 +16,10 @@ if defined?(WIN32OLE::Variable)
@var2 = variables.find {|v| v.name == 'UILevel'}
end
def test_toplevel_constants_backward_compatibility
assert_equal(WIN32OLE::Variable, ::WIN32OLE_VARIABLE)
end
def test_initialize
assert_raise(TypeError) {WIN32OLE::Variable.new}
end

View File

@ -17,6 +17,10 @@ if defined?(WIN32OLE::Variant)
WIN32OLE.locale = @orglocale
end
def test_toplevel_constants_backward_compatibility
assert_equal(WIN32OLE::Variant, ::WIN32OLE_VARIANT)
end
def test_s_new
obj = WIN32OLE::Variant.new('foo')
assert_instance_of(WIN32OLE::Variant, obj)

View File

@ -8,6 +8,11 @@ require "test/unit"
if defined?(WIN32OLE::VARIANT)
class TestWin32OLE_VARIANT_MODULE < Test::Unit::TestCase
include WIN32OLE::VARIANT
def test_toplevel_constants_backward_compatibility
assert_equal(WIN32OLE::VariantType, WIN32OLE::VARIANT)
end
def test_variant
assert_equal(0, VT_EMPTY)
assert_equal(1, VT_NULL)