mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/test_module.rb (TestModule): removed remove_*_mixins methods.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6a894686d6
commit
1d234a1614
1 changed files with 8 additions and 31 deletions
|
@ -64,29 +64,6 @@ class TestModule < Test::Unit::TestCase
|
|||
|
||||
# Support stuff
|
||||
|
||||
def remove_pp_mixins(list)
|
||||
list.reject {|c| c == PP::ObjectMixin }
|
||||
end
|
||||
|
||||
def remove_json_mixins(list)
|
||||
list.reject {|c| c.to_s.start_with?("JSON") }
|
||||
end
|
||||
|
||||
def remove_rake_mixins(list)
|
||||
list.reject {|c|
|
||||
name = c.name
|
||||
name.start_with?("Rake") or name.start_with?("FileUtils")
|
||||
}
|
||||
end
|
||||
|
||||
def remove_minitest_mixins(list)
|
||||
list.reject {|c| c.to_s.start_with?("MiniTest") }
|
||||
end
|
||||
|
||||
def remove_mkmf_mixins(list)
|
||||
list.reject {|c| c.to_s.start_with?("MakeMakefile") }
|
||||
end
|
||||
|
||||
module Mixin
|
||||
MIXIN = 1
|
||||
def mixin
|
||||
|
@ -224,10 +201,10 @@ class TestModule < Test::Unit::TestCase
|
|||
assert_equal([User, Mixin], User.ancestors)
|
||||
assert_equal([Mixin], Mixin.ancestors)
|
||||
|
||||
assert_equal([Object, Kernel, BasicObject],
|
||||
remove_mkmf_mixins(remove_minitest_mixins(remove_rake_mixins(remove_json_mixins(remove_pp_mixins(Object.ancestors))))))
|
||||
assert_equal([String, Comparable, Object, Kernel, BasicObject],
|
||||
remove_mkmf_mixins(remove_minitest_mixins(remove_rake_mixins(remove_json_mixins(remove_pp_mixins(String.ancestors))))))
|
||||
ancestors = Object.ancestors
|
||||
mixins = ancestors - [Object, Kernel, BasicObject]
|
||||
assert_equal([Object, Kernel, BasicObject], ancestors - mixins)
|
||||
assert_equal([String, Comparable, Object, Kernel, BasicObject], String.ancestors - mixins)
|
||||
end
|
||||
|
||||
CLASS_EVAL = 2
|
||||
|
@ -284,10 +261,10 @@ class TestModule < Test::Unit::TestCase
|
|||
def test_included_modules
|
||||
assert_equal([], Mixin.included_modules)
|
||||
assert_equal([Mixin], User.included_modules)
|
||||
assert_equal([Kernel],
|
||||
remove_mkmf_mixins(remove_minitest_mixins(remove_rake_mixins(remove_json_mixins(remove_pp_mixins(Object.included_modules))))))
|
||||
assert_equal([Comparable, Kernel],
|
||||
remove_mkmf_mixins(remove_minitest_mixins(remove_rake_mixins(remove_json_mixins(remove_pp_mixins(String.included_modules))))))
|
||||
|
||||
mixins = Object.included_modules - [Kernel]
|
||||
assert_equal([Kernel], Object.included_modules - mixins)
|
||||
assert_equal([Comparable, Kernel], String.included_modules - mixins)
|
||||
end
|
||||
|
||||
def test_instance_methods
|
||||
|
|
Loading…
Reference in a new issue