1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/win32ole/test_win32ole.rb
suke 0c2571d621 accept hash argument of Symbol key.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-19 07:53:27 +00:00

44 lines
1.3 KiB
Ruby

#
# 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