summaryrefslogtreecommitdiff
path: root/test/win32ole
diff options
context:
space:
mode:
authorsuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-06 07:52:04 +0000
committersuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-06 07:52:04 +0000
commit6057695c87cf8281f3ff9aa37cfdf1c317e1f9c1 (patch)
treea0b1760f55372e3fda29f4b3ea434493cebfe402 /test/win32ole
parent3fd37d082402858facc7e0b4c8847f113394659f (diff)
* ext/win32ole/win32ole_variant.c (ole_val2variant_err,
ole_val2variantdata, Init_win32ole_variant): support VT_ERROR variant with error code. add WIN32OLE_VARIANT::NoParam. * test/win32ole/test_win32ole_variant.rb(test_c_noparam, test_vt_error_noparam): ditto. * ext/win32ole/win32ole.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/win32ole')
-rw-r--r--test/win32ole/test_win32ole_variant.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/win32ole/test_win32ole_variant.rb b/test/win32ole/test_win32ole_variant.rb
index a4edc08..8f53dbe 100644
--- a/test/win32ole/test_win32ole_variant.rb
+++ b/test/win32ole/test_win32ole_variant.rb
@@ -679,6 +679,34 @@ if defined?(WIN32OLE_VARIANT)
assert_nil(WIN32OLE_VARIANT::Null.value)
end
+ def test_c_noparam
+ # DISP_E_PARAMNOTFOUND
+ assert_equal(-2147352572, WIN32OLE_VARIANT::NoParam.value)
+ end
+
+ def test_vt_error_noparam
+ v = WIN32OLE_VARIANT.new(-1, WIN32OLE::VARIANT::VT_ERROR)
+ assert_equal(-1, v.value)
+ fso = WIN32OLE.new("Scripting.FileSystemObject")
+ exc = assert_raise(WIN32OLERuntimeError) {
+ fso.openTextFile("NonExistingFile", v, false)
+ }
+ assert_match(/Type mismatch/i, exc.message)
+ exc = assert_raise(WIN32OLERuntimeError) {
+ fso.openTextFile("NonExistingFile", WIN32OLE_VARIANT::NoParam, false)
+ }
+ # 800A0035 is 'file not found' error.
+ assert_match(/800A0035/, exc.message)
+
+ # -2147352572 is DISP_E_PARAMNOTFOUND
+ v = WIN32OLE_VARIANT.new(-2147352572, WIN32OLE::VARIANT::VT_ERROR)
+ exc = assert_raise(WIN32OLERuntimeError) {
+ fso.openTextFile("NonExistingFile", WIN32OLE_VARIANT::NoParam, false)
+ }
+ # 800A0035 is 'file not found' error code.
+ assert_match(/800A0035/, exc.message)
+ end
+
end
end