diff options
author | Nobuyoshi Nakada <[email protected]> | 2024-03-23 19:07:46 +0900 |
---|---|---|
committer | git <[email protected]> | 2024-03-23 10:34:35 +0000 |
commit | a8075caa4e7681ca274d474cdc15fbeee9ad9d2a (patch) | |
tree | f5938140e2fbc296fd1d22f376c4d7f23820320f | |
parent | 401251979b74d6c04241da593499bc829f5173ba (diff) |
[ruby/win32ole] Test constants for the backward compatibility
https://github.com/ruby/win32ole/commit/22facf50fd
-rw-r--r-- | test/win32ole/test_win32ole.rb | 5 | ||||
-rw-r--r-- | test/win32ole/test_win32ole_event.rb | 4 | ||||
-rw-r--r-- | test/win32ole/test_win32ole_method.rb | 4 | ||||
-rw-r--r-- | test/win32ole/test_win32ole_param.rb | 4 | ||||
-rw-r--r-- | test/win32ole/test_win32ole_record.rb | 6 | ||||
-rw-r--r-- | test/win32ole/test_win32ole_type.rb | 3 | ||||
-rw-r--r-- | test/win32ole/test_win32ole_typelib.rb | 4 | ||||
-rw-r--r-- | test/win32ole/test_win32ole_variable.rb | 4 | ||||
-rw-r--r-- | test/win32ole/test_win32ole_variant.rb | 4 | ||||
-rw-r--r-- | test/win32ole/test_win32ole_variant_m.rb | 5 |
10 files changed, 43 insertions, 0 deletions
diff --git a/test/win32ole/test_win32ole.rb b/test/win32ole/test_win32ole.rb index b0c147b311..e6347e89b4 100644 --- a/test/win32ole/test_win32ole.rb +++ b/test/win32ole/test_win32ole.rb @@ -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) diff --git a/test/win32ole/test_win32ole_event.rb b/test/win32ole/test_win32ole_event.rb index da3ee8567e..d52f8cf9b3 100644 --- a/test/win32ole/test_win32ole_event.rb +++ b/test/win32ole/test_win32ole_event.rb @@ -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") diff --git a/test/win32ole/test_win32ole_method.rb b/test/win32ole/test_win32ole_method.rb index 4b3e255fdc..c84c4027ff 100644 --- a/test/win32ole/test_win32ole_method.rb +++ b/test/win32ole/test_win32ole_method.rb @@ -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) { diff --git a/test/win32ole/test_win32ole_param.rb b/test/win32ole/test_win32ole_param.rb index 551da537fc..13ca9d0cfb 100644 --- a/test/win32ole/test_win32ole_param.rb +++ b/test/win32ole/test_win32ole_param.rb @@ -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") diff --git a/test/win32ole/test_win32ole_record.rb b/test/win32ole/test_win32ole_record.rb index b2f26403bb..49205ce53d 100644 --- a/test/win32ole/test_win32ole_record.rb +++ b/test/win32ole/test_win32ole_record.rb @@ -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 diff --git a/test/win32ole/test_win32ole_type.rb b/test/win32ole/test_win32ole_type.rb index 32aafcbbad..9abcd68c9b 100644 --- a/test/win32ole/test_win32ole_type.rb +++ b/test/win32ole/test_win32ole_type.rb @@ -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 diff --git a/test/win32ole/test_win32ole_typelib.rb b/test/win32ole/test_win32ole_typelib.rb index f743ad68f9..31d6122756 100644 --- a/test/win32ole/test_win32ole_typelib.rb +++ b/test/win32ole/test_win32ole_typelib.rb @@ -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) diff --git a/test/win32ole/test_win32ole_variable.rb b/test/win32ole/test_win32ole_variable.rb index 74a6cbd890..646cf68915 100644 --- a/test/win32ole/test_win32ole_variable.rb +++ b/test/win32ole/test_win32ole_variable.rb @@ -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 diff --git a/test/win32ole/test_win32ole_variant.rb b/test/win32ole/test_win32ole_variant.rb index 1837a1e1d6..13b9a229a5 100644 --- a/test/win32ole/test_win32ole_variant.rb +++ b/test/win32ole/test_win32ole_variant.rb @@ -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) diff --git a/test/win32ole/test_win32ole_variant_m.rb b/test/win32ole/test_win32ole_variant_m.rb index 25ad56cc21..3c2884644c 100644 --- a/test/win32ole/test_win32ole_variant_m.rb +++ b/test/win32ole/test_win32ole_variant_m.rb @@ -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) |