summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-08 13:24:11 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-08 13:24:11 +0000
commitcff97cc9f0adbc40df8a05b5d3ce795f318bd489 (patch)
treeef8d23ebd9fbedc5dd2c11a614394d1dd4166c3d /test
parent86846f0ee50d4cd2a8783bc414a6e7904a6ece4f (diff)
downloadruby-cff97cc9f0adbc40df8a05b5d3ce795f318bd489.tar.gz
* test/ruby/test_module.rb: fix to use Symbol instead of String
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_module.rb48
1 files changed, 24 insertions, 24 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 471d6f6481..81ba08cf32 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -173,7 +173,7 @@ class TestModule < Test::Unit::TestCase
def test_class_eval
Other.class_eval("CLASS_EVAL = 1")
assert_equal(1, Other::CLASS_EVAL)
- assert(Other.constants.include?("CLASS_EVAL"))
+ assert(Other.constants.include?(:CLASS_EVAL))
end
def test_class_variable_set
@@ -206,8 +206,8 @@ class TestModule < Test::Unit::TestCase
end
def test_constants
- assert_equal(["MIXIN"], Mixin.constants)
- assert_equal(["MIXIN", "USER"], User.constants.sort)
+ assert_equal([:MIXIN], Mixin.constants)
+ assert_equal([:MIXIN, :USER], User.constants.sort)
end
def test_included_modules
@@ -219,15 +219,15 @@ class TestModule < Test::Unit::TestCase
end
def test_instance_methods
- assert_equal(["user" ], User.instance_methods(false))
- assert_equal(["user", "mixin"].sort, User.instance_methods(true).sort)
- assert_equal(["mixin"], Mixin.instance_methods)
- assert_equal(["mixin"], Mixin.instance_methods(true))
+ assert_equal([:user], User.instance_methods(false))
+ assert_equal([:user, :mixin].sort, User.instance_methods(true).sort)
+ assert_equal([:mixin], Mixin.instance_methods)
+ assert_equal([:mixin], Mixin.instance_methods(true))
# Ruby 1.8 feature change:
# #instance_methods includes protected methods.
- #assert_equal(["aClass"], AClass.instance_methods(false))
- assert_equal(["aClass", "aClass2"], AClass.instance_methods(false).sort)
- assert_equal(["aClass", "aClass2"],
+ #assert_equal([:aClass], AClass.instance_methods(false))
+ assert_equal([:aClass, :aClass2], AClass.instance_methods(false).sort)
+ assert_equal([:aClass, :aClass2],
(AClass.instance_methods(true) - Object.instance_methods(true)).sort)
end
@@ -235,17 +235,17 @@ class TestModule < Test::Unit::TestCase
assert(!User.method_defined?(:wombat))
assert(User.method_defined?(:user))
assert(User.method_defined?(:mixin))
- assert(!User.method_defined?("wombat"))
- assert(User.method_defined?("user"))
- assert(User.method_defined?("mixin"))
+ assert(!User.method_defined?(:wombat))
+ assert(User.method_defined?(:user))
+ assert(User.method_defined?(:mixin))
end
def test_module_eval
User.module_eval("MODULE_EVAL = 1")
assert_equal(1, User::MODULE_EVAL)
- assert(User.constants.include?("MODULE_EVAL"))
+ assert(User.constants.include?(:MODULE_EVAL))
User.instance_eval("remove_const(:MODULE_EVAL)")
- assert(!User.constants.include?("MODULE_EVAL"))
+ assert(!User.constants.include?(:MODULE_EVAL))
end
def test_name
@@ -261,17 +261,17 @@ class TestModule < Test::Unit::TestCase
end
def test_private_instance_methods
- assert_equal(["aClass1"], AClass.private_instance_methods(false))
- assert_equal(["bClass2"], BClass.private_instance_methods(false))
- assert_equal(["aClass1", "bClass2"],
+ assert_equal([:aClass1], AClass.private_instance_methods(false))
+ assert_equal([:bClass2], BClass.private_instance_methods(false))
+ assert_equal([:aClass1, :bClass2],
(BClass.private_instance_methods(true) -
Object.private_instance_methods(true)).sort)
end
def test_protected_instance_methods
- assert_equal(["aClass2"], AClass.protected_instance_methods)
- assert_equal(["bClass3"], BClass.protected_instance_methods(false))
- assert_equal(["bClass3", "aClass2"].sort,
+ assert_equal([:aClass2], AClass.protected_instance_methods)
+ assert_equal([:bClass3], BClass.protected_instance_methods(false))
+ assert_equal([:bClass3, :aClass2].sort,
(BClass.protected_instance_methods(true) -
Object.protected_instance_methods(true)).sort)
end
@@ -283,15 +283,15 @@ class TestModule < Test::Unit::TestCase
end
def test_public_instance_methods
- assert_equal(["aClass"], AClass.public_instance_methods(false))
- assert_equal(["bClass1"], BClass.public_instance_methods(false))
+ assert_equal([:aClass], AClass.public_instance_methods(false))
+ assert_equal([:bClass1], BClass.public_instance_methods(false))
end
def test_s_constants
c1 = Module.constants
Object.module_eval "WALTER = 99"
c2 = Module.constants
- assert_equal(["WALTER"], c2 - c1)
+ assert_equal([:WALTER], c2 - c1)
end
module M1