summaryrefslogtreecommitdiff
path: root/test/win32ole
diff options
context:
space:
mode:
authorsuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-11-06 12:38:49 +0000
committersuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-11-06 12:38:49 +0000
commit696e6a9b7655c5dd32c4468c105e2a471f712cd6 (patch)
treedbd4b5fc2e27c72c4bf12028dd22f4032892fc71 /test/win32ole
parent0ca8c28e4d250e90e368a62fd2cc5edb2098cb90 (diff)
* ext/win32ole/win32ole.c (fole_s_connect, fole_initialize,
folevariant_initialize): check argument type of WIN32OLE.connect, WIN32OLE.new, WIN32OLE_VARIANT.new. * test/win32ole/test_win32ole.rb (test_s_new_exc, test_s_connect_exc): ditto. * test/win32ole/test_win32ole_variant.rb (test_s_new_exc): ditto. * test/win32ole/test_win32ole_method.rb: add assertion of WIN32OLE_METHOD.new. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/win32ole')
-rw-r--r--test/win32ole/test_win32ole.rb15
-rw-r--r--test/win32ole/test_win32ole_method.rb3
-rw-r--r--test/win32ole/test_win32ole_variant.rb6
3 files changed, 24 insertions, 0 deletions
diff --git a/test/win32ole/test_win32ole.rb b/test/win32ole/test_win32ole.rb
index 983c479..b946aa6 100644
--- a/test/win32ole/test_win32ole.rb
+++ b/test/win32ole/test_win32ole.rb
@@ -153,6 +153,15 @@ if defined?(WIN32OLE)
assert_instance_of(WIN32OLE, @dict2)
end
+ def test_s_new_exc
+ assert_raise(TypeError) {
+ WIN32OLE.new(1)
+ }
+ assert_raise(TypeError) {
+ WIN32OLE.new("Scripting.Dictionary", 1)
+ }
+ end
+
def test_s_new_DCOM
rshell = WIN32OLE.new("Shell.Application")
assert_instance_of(WIN32OLE, rshell)
@@ -172,6 +181,12 @@ if defined?(WIN32OLE)
assert_instance_of(WIN32OLE, obj)
end
+ def test_s_connect_exc
+ assert_raise(TypeError) {
+ WIN32OLE.connect(1)
+ }
+ end
+
def test_invoke_accept_symbol_hash_key
fso = WIN32OLE.new('Scripting.FileSystemObject')
afolder = fso.getFolder(".")
diff --git a/test/win32ole/test_win32ole_method.rb b/test/win32ole/test_win32ole_method.rb
index 161b102..f2ed0c6 100644
--- a/test/win32ole/test_win32ole_method.rb
+++ b/test/win32ole/test_win32ole_method.rb
@@ -24,6 +24,9 @@ if defined?(WIN32OLE_METHOD)
def test_initialize
ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell")
+ assert_raise(TypeError) {
+ WIN32OLE_METHOD.new(1, 2)
+ }
assert_raise(ArgumentError) {
method = WIN32OLE_METHOD.new("foo")
}
diff --git a/test/win32ole/test_win32ole_variant.rb b/test/win32ole/test_win32ole_variant.rb
index 1226e0d..af38768 100644
--- a/test/win32ole/test_win32ole_variant.rb
+++ b/test/win32ole/test_win32ole_variant.rb
@@ -18,6 +18,12 @@ if defined?(WIN32OLE_VARIANT)
assert_instance_of(WIN32OLE_VARIANT, obj)
end
+ def test_s_new_exc
+ assert_raise(TypeError) {
+ WIN32OLE_VARIANT.new(/foo/)
+ }
+ end
+
def test_s_new_no_argument
ex = nil
begin