Skip to content

Commit 22facf5

Browse files
committed
Test constants for the backward compatibility
1 parent 57e4a38 commit 22facf5

10 files changed

+43
-0
lines changed

test/win32ole/test_win32ole.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ def test_s_new
167167
assert_instance_of(WIN32OLE, @dict2)
168168
end
169169

170+
def test_toplevel_constants_backward_compatibility
171+
assert_equal(WIN32OLE::RuntimeError, ::WIN32OLERuntimeError)
172+
assert_equal(WIN32OLE::QueryInterfaceError, ::WIN32OLEQueryInterfaceError)
173+
end
174+
170175
def test_s_new_exc
171176
assert_raise(TypeError) {
172177
WIN32OLE.new(1)

test/win32ole/test_win32ole_event.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030

3131
if defined?(WIN32OLE::Event)
3232
class TestWIN32OLE_EVENT < Test::Unit::TestCase
33+
def test_toplevel_constants_backward_compatibility
34+
assert_equal(WIN32OLE::Event, ::WIN32OLE_EVENT)
35+
end
36+
3337
def test_s_new_exception
3438
assert_raise(TypeError) {
3539
WIN32OLE::Event.new("A")

test/win32ole/test_win32ole_method.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ def setup
2020
@m_file_name = WIN32OLE::Method.new(ole_type, "name")
2121
end
2222

23+
def test_toplevel_constants_backward_compatibility
24+
assert_equal(WIN32OLE::Method, ::WIN32OLE_METHOD)
25+
end
26+
2327
def test_initialize
2428
ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell")
2529
assert_raise(TypeError) {

test/win32ole/test_win32ole_param.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ def setup
2727
@param_key = m_add.params[0]
2828
end
2929

30+
def test_constants_backward_compatibility
31+
assert_equal(WIN32OLE::Param, ::WIN32OLE_PARAM)
32+
end
33+
3034
def test_s_new
3135
assert_raise(ArgumentError) {
3236
WIN32OLE::Param.new("hoge")

test/win32ole/test_win32ole_record.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@
6666

6767

6868
if defined?(WIN32OLE::Record)
69+
class TestWIN32OLE_RECORD < Test::Unit::TestCase
70+
def test_toplevel_constants_backward_compatibility
71+
assert_equal(WIN32OLE::Record, ::WIN32OLE_RECORD)
72+
end
73+
end
74+
6975
def rbcomtest_exist?
7076
WIN32OLE.new(PROGID_RBCOMTEST)
7177
true

test/win32ole/test_win32ole_type.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
if defined?(WIN32OLE::Type)
99
class TestWIN32OLE_TYPE < Test::Unit::TestCase
10+
def test_toplevel_constants_backward_compatibility
11+
assert_equal(WIN32OLE::Type, ::WIN32OLE_TYPE)
12+
end
1013

1114
def test_s_progids
1215
progids = WIN32OLE::Type.progids

test/win32ole/test_win32ole_typelib.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
if defined?(WIN32OLE::TypeLib)
99
class TestWIN32OLE_TYPELIB < Test::Unit::TestCase
10+
def test_toplevel_constants_backward_compatibility
11+
assert_equal(WIN32OLE::TypeLib, ::WIN32OLE_TYPELIB)
12+
end
13+
1014
def test_s_typelibs
1115
tlibs = WIN32OLE::TypeLib.typelibs
1216
assert_instance_of(Array, tlibs)

test/win32ole/test_win32ole_variable.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ def setup
1616
@var2 = variables.find {|v| v.name == 'UILevel'}
1717
end
1818

19+
def test_toplevel_constants_backward_compatibility
20+
assert_equal(WIN32OLE::Variable, ::WIN32OLE_VARIABLE)
21+
end
22+
1923
def test_initialize
2024
assert_raise(TypeError) {WIN32OLE::Variable.new}
2125
end

test/win32ole/test_win32ole_variant.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ def teardown
1717
WIN32OLE.locale = @orglocale
1818
end
1919

20+
def test_toplevel_constants_backward_compatibility
21+
assert_equal(WIN32OLE::Variant, ::WIN32OLE_VARIANT)
22+
end
23+
2024
def test_s_new
2125
obj = WIN32OLE::Variant.new('foo')
2226
assert_instance_of(WIN32OLE::Variant, obj)

test/win32ole/test_win32ole_variant_m.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
if defined?(WIN32OLE::VARIANT)
99
class TestWin32OLE_VARIANT_MODULE < Test::Unit::TestCase
1010
include WIN32OLE::VARIANT
11+
12+
def test_toplevel_constants_backward_compatibility
13+
assert_equal(WIN32OLE::VariantType, WIN32OLE::VARIANT)
14+
end
15+
1116
def test_variant
1217
assert_equal(0, VT_EMPTY)
1318
assert_equal(1, VT_NULL)

0 commit comments

Comments
 (0)