summaryrefslogtreecommitdiff
path: root/test/win32ole/test_win32ole.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/win32ole/test_win32ole.rb')
-rw-r--r--test/win32ole/test_win32ole.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/win32ole/test_win32ole.rb b/test/win32ole/test_win32ole.rb
new file mode 100644
index 0000000000..f1bdb2c208
--- /dev/null
+++ b/test/win32ole/test_win32ole.rb
@@ -0,0 +1,44 @@
+#
+# This script check that Win32OLE can execute InvokeVerb method of FolderItem2.
+#
+
+begin
+ require 'win32ole'
+rescue LoadError
+end
+require 'test/unit'
+
+if defined?(WIN32OLE)
+ class TestWin32OLE < Test::Unit::TestCase
+ def test_invoke_accept_symbol_hash_key
+ fso = WIN32OLE.new('Scripting.FileSystemObject')
+ afolder = fso.getFolder(".")
+ bfolder = fso.getFolder({"FolderPath" => "."})
+ cfolder = fso.getFolder({:FolderPath => "."})
+ assert_equal(afolder.path, bfolder.path)
+ assert_equal(afolder.path, cfolder.path)
+ fso = nil
+ end
+ def test_invoke_hash_key_non_str_sym
+ fso = WIN32OLE.new('Scripting.FileSystemObject')
+ begin
+ bfolder = fso.getFolder({1 => "."})
+ assert(false)
+ rescue TypeError
+ assert(true)
+ end
+ fso = nil
+ end
+ def test_invoke_accept_multi_hash_key
+ shell = WIN32OLE.new('Shell.Application')
+ folder = shell.nameSpace(0)
+ item = folder.items.item(0)
+ name = folder.getDetailsOf(item, 0)
+ assert_equal(item.name, name)
+ name = folder.getDetailsOf({:vItem => item, :iColumn => 0})
+ assert_equal(item.name, name)
+ name = folder.getDetailsOf({"vItem" => item, :iColumn => 0})
+ assert_equal(item.name, name)
+ end
+ end
+end