aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-12-28 13:54:16 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-12-30 21:13:11 +0900
commitdb547a3bc457e55c07880ae5d2d77f55b93775eb (patch)
treee793f897f73954944d5c1596a35bc689b477f18e
parent31c69d66d2200566695a0c88dd68cdd04a77614d (diff)
downloadruby-db547a3bc457e55c07880ae5d2d77f55b93775eb.tar.gz
[ruby/win32ole] Undefine allocator of WIN32OLE_VARIABLE to get rid of warning
https://github.com/ruby/win32ole/commit/27d0fdc622
-rw-r--r--ext/win32ole/win32ole_variable.c1
-rw-r--r--test/win32ole/test_win32ole_variable.rb4
2 files changed, 5 insertions, 0 deletions
diff --git a/ext/win32ole/win32ole_variable.c b/ext/win32ole/win32ole_variable.c
index 803083156c..8d80455d97 100644
--- a/ext/win32ole/win32ole_variable.c
+++ b/ext/win32ole/win32ole_variable.c
@@ -370,6 +370,7 @@ VALUE cWIN32OLE_VARIABLE;
void Init_win32ole_variable(void)
{
cWIN32OLE_VARIABLE = rb_define_class("WIN32OLE_VARIABLE", rb_cObject);
+ rb_undef_alloc_func(cWIN32OLE_VARIABLE);
rb_define_method(cWIN32OLE_VARIABLE, "name", folevariable_name, 0);
rb_define_method(cWIN32OLE_VARIABLE, "ole_type", folevariable_ole_type, 0);
rb_define_method(cWIN32OLE_VARIABLE, "ole_type_detail", folevariable_ole_type_detail, 0);
diff --git a/test/win32ole/test_win32ole_variable.rb b/test/win32ole/test_win32ole_variable.rb
index 826029e0a8..8af3f987a8 100644
--- a/test/win32ole/test_win32ole_variable.rb
+++ b/test/win32ole/test_win32ole_variable.rb
@@ -16,6 +16,10 @@ if defined?(WIN32OLE_VARIABLE)
@var2 = variables.find {|v| v.name == 'UILevel'}
end
+ def test_initialize
+ assert_raise(TypeError) {WIN32OLE_VARIABLE.new}
+ end
+
def test_name
assert_equal('ssfDESKTOP', @var1.name)
end