1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/win32ole/win32ole.c (ole_invoke): WIN32OLE#[] and WIN32OLE#[]=

accepts number argument.

* test/win32ole/test_win32ole.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
suke 2008-08-27 14:43:23 +00:00
parent ad3c6c712b
commit f6f85ad683
3 changed files with 16 additions and 1 deletions

View file

@ -1,3 +1,10 @@
Wed Aug 27 23:28:51 2008 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* ext/win32ole/win32ole.c (ole_invoke): WIN32OLE#[] and WIN32OLE#[]=
accepts number argument.
* test/win32ole/test_win32ole.rb: ditto.
Wed Aug 27 14:45:34 2008 NARUSE, Yui <naruse@ruby-lang.org>
* test/cgi/test_cgi_core.rb: add core test.

View file

@ -3225,7 +3225,7 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
op.dp.cArgs = 0;
rb_scan_args(argc, argv, "1*", &cmd, &paramS);
if(TYPE(cmd) != T_STRING && TYPE(cmd) != T_SYMBOL) {
if(TYPE(cmd) != T_STRING && TYPE(cmd) != T_SYMBOL && !is_bracket) {
rb_raise(rb_eTypeError, "method is wrong type (expected String or Symbol)");
}
if (TYPE(cmd) == T_SYMBOL) {

View file

@ -119,6 +119,14 @@ if defined?(WIN32OLE)
assert_equal("BAR", @dict1["foo"])
end
def test_bracket_with_numkey
@dict1.add(1, "ONE")
@dict1.add(2, "two")
assert_equal("ONE", @dict1[1])
@dict1[2] = "TWO"
assert_equal("TWO", @dict1[2])
end
def test_invoke_with_array
@dict1.add("ary1", [1,2,3])
assert_equal([1,2,3], @dict1["ary1"])