Skip to content

Commit

Permalink
Merge pull request #23 from nobu/test_compatibility
Browse files Browse the repository at this point in the history
Test constants for the backward compatibility
  • Loading branch information
nobu authored Mar 23, 2024
2 parents 57e4a38 + 22facf5 commit 7c825c1
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/win32ole/test_win32ole.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ def test_s_new
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)
Expand Down
4 changes: 4 additions & 0 deletions test/win32ole/test_win32ole_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@

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")
Expand Down
4 changes: 4 additions & 0 deletions test/win32ole/test_win32ole_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ def setup
@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) {
Expand Down
4 changes: 4 additions & 0 deletions test/win32ole/test_win32ole_param.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def setup
@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")
Expand Down
6 changes: 6 additions & 0 deletions test/win32ole/test_win32ole_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@


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
Expand Down
3 changes: 3 additions & 0 deletions test/win32ole/test_win32ole_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

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
Expand Down
4 changes: 4 additions & 0 deletions test/win32ole/test_win32ole_typelib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

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)
Expand Down
4 changes: 4 additions & 0 deletions test/win32ole/test_win32ole_variable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ def setup
@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
Expand Down
4 changes: 4 additions & 0 deletions test/win32ole/test_win32ole_variant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ def teardown
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)
Expand Down
5 changes: 5 additions & 0 deletions test/win32ole/test_win32ole_variant_m.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
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)
Expand Down

0 comments on commit 7c825c1

Please sign in to comment.