mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* class.c (check_mix_method_i, do_mix_method_i): not mix methods
renamed as nil. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a8009c20d9
commit
40930b7144
3 changed files with 22 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Sat Jun 4 11:30:57 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* class.c (check_mix_method_i, do_mix_method_i): not mix methods
|
||||
renamed as nil.
|
||||
|
||||
Sat Jun 4 04:04:41 2011 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* test/rubygems/test_gem_commands_which_command.rb:
|
||||
|
|
2
class.c
2
class.c
|
@ -745,6 +745,7 @@ check_mix_method_i(st_data_t key, st_data_t value, st_data_t arg)
|
|||
st_data_t alias;
|
||||
|
||||
if (aliasing && st_lookup(aliasing, ID2SYM(id), &alias)) {
|
||||
if (NIL_P(alias)) return ST_CONTINUE;
|
||||
id = rb_to_id(alias);
|
||||
}
|
||||
if (st_lookup(argp->mtbl, id, NULL)) {
|
||||
|
@ -763,6 +764,7 @@ do_mix_method_i(st_data_t key, st_data_t value, st_data_t arg)
|
|||
st_data_t old, alias;
|
||||
|
||||
if (aliasing && st_lookup(aliasing, ID2SYM(id), &alias)) {
|
||||
if (NIL_P(alias)) return ST_CONTINUE;
|
||||
id = rb_to_id(alias);
|
||||
}
|
||||
if (st_lookup(argp->mtbl, id, &old)) {
|
||||
|
|
|
@ -1096,5 +1096,20 @@ class TestModule < Test::Unit::TestCase
|
|||
mix japanese, :address => :jp_address, :address= => :jp_address=
|
||||
}
|
||||
}
|
||||
|
||||
japanese_american = Class.new
|
||||
assert_nothing_raised(ArgumentError) {
|
||||
japanese_american.class_eval {
|
||||
mix japanese, :address => nil, :address= => nil
|
||||
}
|
||||
}
|
||||
assert_raise(NoMethodError) {
|
||||
japanese_american.new.address
|
||||
}
|
||||
assert_nothing_raised(ArgumentError) {
|
||||
japanese_american.class_eval {
|
||||
mix american
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue