diff options
Diffstat (limited to 'test/win32ole')
-rw-r--r-- | test/win32ole/test_win32ole.rb | 20 | ||||
-rw-r--r-- | test/win32ole/test_win32ole_variant.rb | 19 |
2 files changed, 36 insertions, 3 deletions
diff --git a/test/win32ole/test_win32ole.rb b/test/win32ole/test_win32ole.rb index bcfd63f4ea..d7a9b368a1 100644 --- a/test/win32ole/test_win32ole.rb +++ b/test/win32ole/test_win32ole.rb @@ -119,6 +119,19 @@ if defined?(WIN32OLE) assert_equal("BAR", @dict1["foo"]) end + def test_invoke_with_array + @dict1.add("ary1", [1,2,3]) + assert_equal([1,2,3], @dict1["ary1"]) + + @dict1.add("ary2", [[1,2,"a"], [3,4,"b"]]) + assert_equal([[1,2,"a"], [3,4,"b"]], @dict1["ary2"]) + + @dict1.add("ary3", [[[1]]]) + assert_equal([[[1]]], @dict1["ary3"]) + + @dict1.add("ary4", [[[1], [2], [3]], [[4], [5], [6]]]) + assert_equal([[[1],[2], [3]], [[4], [5], [6]]], @dict1["ary4"]) + end end class TestWin32OLE < Test::Unit::TestCase @@ -146,9 +159,10 @@ if defined?(WIN32OLE) assert_match(/unknown OLE server: `\{000\}'/, exc.message) end - # test_s_connect was moved to test_word.rb - # def test_s_connect - # end + def test_s_connect + obj = WIN32OLE.connect("winmgmts:") + assert_instance_of(WIN32OLE, obj) + end def test_invoke_accept_symbol_hash_key fso = WIN32OLE.new('Scripting.FileSystemObject') diff --git a/test/win32ole/test_win32ole_variant.rb b/test/win32ole/test_win32ole_variant.rb index b00052e534..418ce57751 100644 --- a/test/win32ole/test_win32ole_variant.rb +++ b/test/win32ole/test_win32ole_variant.rb @@ -93,6 +93,25 @@ if defined?(WIN32OLE_VARIANT) def test_create_vt_array obj = WIN32OLE_VARIANT.new([1.2, 2.3], WIN32OLE::VARIANT::VT_ARRAY|WIN32OLE::VARIANT::VT_R8) assert_equal([1.2, 2.3], obj.value) + assert_equal(WIN32OLE::VARIANT::VT_ARRAY|WIN32OLE::VARIANT::VT_R8, obj.vartype) + end + + def test_create_vt_array2 + obj = WIN32OLE_VARIANT.new([1.2, "a"], WIN32OLE::VARIANT::VT_ARRAY) + assert_equal([1.2, "a"], obj.value) + assert_equal(WIN32OLE::VARIANT::VT_ARRAY|WIN32OLE::VARIANT::VT_VARIANT, obj.vartype) + + obj = WIN32OLE_VARIANT.new([1.2, "a"]) + assert_equal([1.2, "a"], obj.value) + assert_equal(WIN32OLE::VARIANT::VT_ARRAY|WIN32OLE::VARIANT::VT_VARIANT, obj.vartype) + end + + def test_create_vt_nested_array + obj = WIN32OLE_VARIANT.new([[1.2, "a", "b"], [3.4, "C", "D"]], WIN32OLE::VARIANT::VT_ARRAY) + assert_equal([[1.2, "a", "b"], [3.4, "C", "D"]], obj.value) + + obj = WIN32OLE_VARIANT.new([[1.2, "a", "b"], [3.4, "C", "D"]]) + assert_equal([[1.2, "a", "b"], [3.4, "C", "D"]], obj.value) end def test_create_vt_array_exc |