Skip to content

Commit

Permalink
fix Module#ancestors and update test
Browse files Browse the repository at this point in the history
  • Loading branch information
skandhas committed Apr 25, 2013
1 parent 4faaef4 commit 8d778d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/class.c
Expand Up @@ -793,7 +793,7 @@ mrb_mod_ancestors(mrb_state *mrb, mrb_value self)
if (c->tt == MRB_TT_ICLASS) {
mrb_ary_push(mrb, result, mrb_obj_value(c->c));
}
else {
else if (c->tt != MRB_TT_SCLASS) {
mrb_ary_push(mrb, result, mrb_obj_value(c));
}
c = c->super;
Expand Down
6 changes: 5 additions & 1 deletion test/t/module.rb
Expand Up @@ -14,8 +14,12 @@
# TODO not implemented ATM assert('Module.nesting', '15.2.2.3.2') do

assert('Module#ancestors', '15.2.2.4.9') do
class Test4ModuleAncestors
end
sc = Test4ModuleAncestors.singleton_class
r = String.ancestors
r.class == Array and r.include?(String) and r.include?(Object)
r.class == Array and r.include?(String) and r.include?(Object) and
! sc.ancestors.include?(sc)
end

assert('Module#append_features', '15.2.2.4.10') do
Expand Down

0 comments on commit 8d778d9

Please sign in to comment.