summaryrefslogtreecommitdiff
path: root/test/win32ole
diff options
context:
space:
mode:
authorsuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-10 12:22:16 +0000
committersuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-10 12:22:16 +0000
commit4f1b06aabd54b86f08cac13498c73fcb0237fe05 (patch)
treec5ab00a9410bd3fa9e1df4780e4c8a7b97c8112d /test/win32ole
parent86714f5b160a5342f6ed9564fe9db30be120100c (diff)
* test/win32ole/test_win32ole_typelib.rb: add some illegal argument test.
* test/win32ole/test_win32ole_type.rb: ditto. * test/win32ole/test_win32ole_event.rb: ditto. * test/win32ole/test_win32ole_param.rb: ditto. * test/win32ole/test_win32ole_method.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/win32ole')
-rw-r--r--test/win32ole/test_win32ole_event.rb6
-rw-r--r--test/win32ole/test_win32ole_method.rb3
-rw-r--r--test/win32ole/test_win32ole_param.rb7
-rw-r--r--test/win32ole/test_win32ole_type.rb6
-rw-r--r--test/win32ole/test_win32ole_typelib.rb5
5 files changed, 27 insertions, 0 deletions
diff --git a/test/win32ole/test_win32ole_event.rb b/test/win32ole/test_win32ole_event.rb
index 4888539..02eaec5 100644
--- a/test/win32ole/test_win32ole_event.rb
+++ b/test/win32ole/test_win32ole_event.rb
@@ -30,6 +30,12 @@ if defined?(WIN32OLE_EVENT)
@event += event
end
+ def test_s_new
+ assert_raise(TypeError) {
+ ev = WIN32OLE_EVENT.new("A")
+ }
+ end
+
def test_s_new_without_itf
ev = WIN32OLE_EVENT.new(@ie)
ev.on_event {|*args| default_handler(*args)}
diff --git a/test/win32ole/test_win32ole_method.rb b/test/win32ole/test_win32ole_method.rb
index 31eff87..161b102 100644
--- a/test/win32ole/test_win32ole_method.rb
+++ b/test/win32ole/test_win32ole_method.rb
@@ -33,6 +33,9 @@ if defined?(WIN32OLE_METHOD)
assert_raise(WIN32OLERuntimeError) {
method = WIN32OLE_METHOD.new(ole_type, "NonExistMethod")
}
+ assert_raise(TypeError) {
+ method = WIN32OLE_METHOD.new(ole_type, 1)
+ }
method = WIN32OLE_METHOD.new(ole_type, "Open")
assert_instance_of(WIN32OLE_METHOD, method)
method = WIN32OLE_METHOD.new(ole_type, "open")
diff --git a/test/win32ole/test_win32ole_param.rb b/test/win32ole/test_win32ole_param.rb
index 4374f9a..1c866ca 100644
--- a/test/win32ole/test_win32ole_param.rb
+++ b/test/win32ole/test_win32ole_param.rb
@@ -29,6 +29,13 @@ if defined?(WIN32OLE_PARAM)
@param_overwritefiles = m_copyfile.params[2]
end
+ def test_s_new
+ assert_raise(ArgumentError) {
+ WIN32OLE_PARAM.new("hoge")
+ }
+ end
+
+
def test_name
assert_equal('URL', @param_url.name)
assert_equal('Flags', @param_flags.name)
diff --git a/test/win32ole/test_win32ole_type.rb b/test/win32ole/test_win32ole_type.rb
index 1aff42a..f8ea525 100644
--- a/test/win32ole/test_win32ole_type.rb
+++ b/test/win32ole/test_win32ole_type.rb
@@ -22,6 +22,12 @@ if defined?(WIN32OLE_TYPE)
assert_raise(ArgumentError) {
WIN32OLE_TYPE.new("foo")
}
+ assert_raise(TypeError) {
+ WIN32OLE_TYPE.new(1, 2)
+ }
+ assert_raise(TypeError) {
+ WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", 1)
+ }
assert_raise(WIN32OLERuntimeError) {
WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "foo")
}
diff --git a/test/win32ole/test_win32ole_typelib.rb b/test/win32ole/test_win32ole_typelib.rb
index 16e6c1a..a1c3891 100644
--- a/test/win32ole/test_win32ole_typelib.rb
+++ b/test/win32ole/test_win32ole_typelib.rb
@@ -18,6 +18,11 @@ if defined?(WIN32OLE_TYPELIB)
assert_raise(ArgumentError) {
WIN32OLE_TYPELIB.new(1,2,3,4)
}
+
+ assert_raise(TypeError) {
+ WIN32OLE_TYPELIB.new(100)
+ }
+
tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation")
assert_instance_of(WIN32OLE_TYPELIB, tlib)