summaryrefslogtreecommitdiff
path: root/test/ruby/test_method.rb
AgeCommit message (Collapse)Author
2015-01-06* test/ruby/test_method.rb: Add test for &-coersion of anheadius
UnboundMethod. * test/ruby/test_module.rb: Add test for define_method given an UnboundMethod. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-25vm_eval.c: preserve encodingnobu
* vm_eval.c (rb_method_call_status): preserve encoding of called method name in error messages. * vm_insnhelper.c (vm_call_method): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13* test/lib/envutil.rb: Moved from test/ruby/.akr
* test/lib/find_executable.rb: Ditto. * test/lib/memory_status.rb: Ditto. * test/lib/test/unit.rb: require envutil. * test/: Don't require envutil in test files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-02* test/ruby/test_method.rb: r48239 makes this test green.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48241 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-26proc.c: method_super_methodnobu
* proc.c (method_super_method): new method Method#super_method, which returns a method object of the method to be called by `super` in the receiver method object. [ruby-core:62202] [Feature #9781] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-19proc.c: Implement Method#currynobu
* proc.c (rb_method_curry): Implement Method#curry, which delegates to to_proc.curry. [ruby-core:62212] [Feature #9783] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-18* vm_eval.c (eval_string_with_cref): Use file path even if scope issorah
given. Related to [ruby-core:56099] [Bug #8662] and r42103. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-25iseq.c: fix parameter of unnamed rest keywords argumentnobu
* iseq.c (rb_iseq_parameters): push argument type symbol only for unnamed rest keywords argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-25proc.c: fix arity of rest keywords argumentnobu
* proc.c (rb_iseq_min_max_arity): maximum argument is unlimited if having rest keywords argument. [ruby-core:53298] [Bug #8072] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-25test_method.rb, test_proc.rb: suppress warningsnobu
* test/ruby/test_method.rb: suppress warnings in verbose mode. * test/ruby/test_proc.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-24test_method.rb: fix testnobu
* test/ruby/test_method.rb (test_define_method_in_private_scope): remove extra *, to get the argument itself. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-24proc.c: make method by define_method publicnobu
* proc.c (rb_mod_define_method): consider visibility only if self in the caller is same as the receiver, otherwise make public as well as old behavior. [ruby-core:57747] [Bug #9005] [ruby-core:58497] [Bug #9141] * vm.c (rb_vm_cref_in_context): return ruby level cref if self is same. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-14proc.c: method by respond_to_missing?nobu
* proc.c (mnew_from_me): method by respond_to_missing? should be owned by the original class. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13proc.c: fix inherited ownernobu
* proc.c (mnew_from_me): achieve the original defined_class from prepended iclass, to fix inherited owner. * proc.c (method_owner): return the defined class, but not the class which the method object is created from. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13proc.c, vm_method.c: fix super and aliasnobu
* proc.c (method_owner): return the class where alias is defined, not the class original method is defined. * vm_method.c (rb_method_entry_make, rb_alias): store the originally defined class in me. [Bug #7993] [Bug #7842] [Bug #9236] * vm_method.c (rb_method_entry_get_without_cache): cache included module but not iclass. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13test/ruby: better assertionsnobu
* test/ruby: use better assertions instead of mere assert. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-05* object.c (rb_class_inherited_p): allow iclasses to be tested forcharliesome
inheritance. [Bug #8686] [ruby-core:56174] * test/ruby/test_method.rb: add test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-22vm_eval.c: use file argumentnobu
* vm_eval.c (eval_string_with_cref): use the given file name unless eval even if scope is given. additional fix for [Bug #8436]. based on the patch by srawlins at [ruby-core:56099] [Bug #8662]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-14vm_eval.c: __dir__ in evalnobu
* vm_eval.c (eval_string_with_cref): propagate absolute path from the binding if it is given explicitly. patch by Gat (Dawid Janczak) at [ruby-core:55123]. [Bug #8436] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-14test_method.rb: use realpathnobu
* test/ruby/test_method.rb (TestMethod#test___dir__): $LOAD_PATH entries are expanded to real paths. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12* safe.c (rb_set_safe_level, safe_setter): raise an ArgumentErrorshugo
when $SAFE is set to 4. $SAFE=4 is now obsolete. [ruby-core:55222] [Feature #8468] * object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust): Kernel#untrusted?, untrust, and trust are now deprecated. Their behavior is same as tainted?, taint, and untaint, respectively. * include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED() and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(), respectively. * array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c, ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c, ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c, ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c, ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c, ext/socket/socket.c, ext/socket/udpsocket.c, ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c, ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c, load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c, safe.c, string.c, thread.c, transcode.c, variable.c, vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for $SAFE=4. * test/dl/test_dl2.rb, test/erb/test_erb.rb, test/readline/test_readline.rb, test/readline/test_readline_history.rb, test/ruby/test_alias.rb, test/ruby/test_array.rb, test/ruby/test_dir.rb, test/ruby/test_encoding.rb, test/ruby/test_env.rb, test/ruby/test_eval.rb, test/ruby/test_exception.rb, test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb, test/ruby/test_io.rb, test/ruby/test_method.rb, test/ruby/test_module.rb, test/ruby/test_object.rb, test/ruby/test_pack.rb, test/ruby/test_rand.rb, test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb, test/ruby/test_struct.rb, test/ruby/test_thread.rb, test/ruby/test_time.rb: remove tests for $SAFE=4. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27test_method.rb: fix for direct invocationnobu
* test/ruby/test_method.rb (TestMethod#test___dir__): use aboslute path for the case invoked directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13proc.c: Kernel#singleton_methodnobu
* proc.c (rb_obj_singleton_method): new method Kernel#singleton_method which returns a Method object of the singleton method. non-singleton method causes NameError, but not aliased or zsuper method, right now. [ruby-core:54914] [Feature #8391] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-31proc.c: consider noex in define_methodnobu
* proc.c (rb_mod_define_method): consider visibility in define_method. patch by mashiro <mail AT mashiro.org>. fix GH-268. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-31test_method.rb: splitnobu
* test/ruby/test_method.rb (test_define_method): split for each tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-25test_method.rb: refine assertionsnobu
* test/ruby/test_method.rb (test_unlinked_method_entry_in_method_object_bug): use assert_normal_exit since subject code never exit successfully, but check if timed out paranoically. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-25* test/ruby/test_method.rb (test_unlinked_method_entry_in_method_object_bug):nobu
move from KNOWNBUGS.rb. [Bug #8100] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-05test_method.rb: reduce iterationnobu
* test/ruby/test_method.rb (TestMethod#test_bound_method_entry): reduce iteration. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-05proc.c: revert r39224nobu
* proc.c (mnew): revert r39224. [ruby-core:53038] [Bug #7988] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-16* vm.c (rb_thread_mark): mark a working Proc of bmethodko1
(a method defined by define_method) even if the method was removed. We could not trace working Proc object which represents the body of bmethod if the method was removed (alias/undef/overridden). Simply, it was mark miss. This patch by Kazuki Tsujimoto. [Bug #7825] NOTE: We can brush up this marking because we do not need to mark `me' on each living control frame. We need to mark `me's only if `me' was free'ed. This is future work after Ruby 2.0.0. * test/ruby/test_method.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-13proc.c: skip prependsnobu
* proc.c (mnew): skip prepending modules and return the method bound on the given class. [ruby-core:52160] [Bug #7836] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-13proc.c: original_namenobu
* proc.c (method_original_name): new methods Method#original_name and UnboundMethod#original_name. [ruby-core:52048] [Bug #7806] [EXPERIMENTAL] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-13proc.c: show the given namenobu
* proc.c (method_inspect): show the given name primarily, and original_id if aliased. [ruby-core:52048] [Bug #7806] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-28* proc.c (method_eq): fix the documentation to refer to owner.shugo
[ruby-core:51105] [Bug #7613] * test/ruby/test_method.rb (test_alias_onwer): new test to confirm that `a == b' returns false if owners of a and b are different. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-13method transplantingnobu
* proc.c (umethod_bind): allow another form of method transplanting from a module via UnboundMethod. [ruby-core:34267][Feature #4254] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01vm_method.c: make initialize methods privatenobu
* id.c (Init_id), template/id.h.tmpl: add initialize_{copy,clone,dup} and respond_to_missing?. * vm_method.c (rb_method_entry_make): make above methods private. [Feature #6539] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-03* eval.c (f_current_dirname): add the new method for Kernel.nari
This method almotst same as File.dirname(__FILE__). One different behavior is it returns nil when __FILE__ returns nil. [Feature #3346] * NEWS: ditto * test/ruby/test_method.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-04__callee__ fixnobu
* eval.c (rb_frame_callee, rb_f_callee_name): fix to return the called id. * vm_insnhelper.c (vm_push_frame): set proper method entry. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-25method transplantingnobu
* proc.c (rb_mod_define_method): allow method transplanting from a module to either class or module. [ruby-core:34267][Feature #4254] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-18* gc.c (free_method_entry_i): method entry may be innobu
unlinked_method_entry_list. [ruby-core:43383][Bug #6171] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-21* proc.c (method_hash, proc_hash): Fix {Unbound}Method#hashmarcandre
[Bug #6048]. Isolate hash computation for proc * internal.h: Declaration for above * vm_method.c (rb_method_definition_hash): Computation for hash part of a method definition * method.h: Declaration for above * test/ruby/test_method.rb: Test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-13* vm_method.c (rb_method_boundp):knu
obj.respond_to?(:a_protected_method) should return false because calling a protected method may cause NoMethodError if called from outside the class inheritance tree. Kernel#respond_to? is mostly used to test if it is safe to call a method, so the false positive should be avoided. [ruby-dev:40461] [ruby-dev:41739] [ruby-dev:41837] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-20* iseq.c (iseq_s_disasm): fix a bug that may cause SEGV.ktsj
* test/ruby/test_method.rb (test_body): add a test for the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-25* vm_insnhelper.c (vm_search_superclass): avoid control framenagachika
stack overrun. currently super() in Proc created in a method defined by Module#define_method raise NoMethodError. [Bug #4881] * test/ruby/test_method.rb t_super_in_proc_from_define_method): add test for it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-05 * eval.c (frame_func_id): __method__ return different name fromnagachika
methods defined by Module#define_method with a same block. [ruby-core:35386] fixes #4606 * eval (method_entry_of_iseq): new helper function. search control frame stack for a method entry which has given iseq. * test/ruby/test_method.rb: add tests for #4696 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-10* test/ruby/test_method.rb (TestMethod#test_define_method): methodnobu
transplanting between class and module is impossible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-03* vm_insnhelper.c (vm_call_method): revert r30064 and r30071,nobu
because of [ruby-core:26761]. Bug#4106 rejected. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-03* vm_insnhelper.c (vm_call_method): protected methods should benobu
checked against the real class. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-03* vm_insnhelper.c (vm_call_method): protected singleton methods shouldnobu
be visible from same real class methods. [ruby-core:33506] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-21* vm_method.c (rb_method_boundp): revert r28543, r28564.naruse
They may be merged in Ruby 2.0. [ruby-core:31217] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e