aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_symbol.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-22 12:10:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-22 12:10:52 +0000
commit10c60cf942c97576613ea84f477169bc529567cc (patch)
tree90d68ca5a5c8a026c22c577ae674af85f8e34fbf /test/ruby/test_symbol.rb
parent53800de4c5ed2eb436771bc3b42da87699002d2e (diff)
downloadruby-10c60cf942c97576613ea84f477169bc529567cc.tar.gz
test_parse.rb: move assertions
* test/ruby/test_module.rb (test_remove_class_variable): move an assertion for Module#remove_class_variable from test_parse.rb. * test/ruby/test_symbol.rb (test_intern, test_all_symbols): move assertions for Symbol#intern and Symbol.all_symbols from test_parse.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_symbol.rb')
-rw-r--r--test/ruby/test_symbol.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb
index 0a055db2c9..7b1dbd3ae7 100644
--- a/test/ruby/test_symbol.rb
+++ b/test/ruby/test_symbol.rb
@@ -12,6 +12,19 @@ class TestSymbol < Test::Unit::TestCase
assert_nothing_raised(SyntaxError) {assert_equal(sym, eval(n))}
end
+ def test_intern
+ assert_equal(':""', ''.intern.inspect)
+ assert_equal(':$foo', '$foo'.intern.inspect)
+ assert_equal(':"!foo"', '!foo'.intern.inspect)
+ assert_equal(':"foo=="', "foo==".intern.inspect)
+ end
+
+ def test_all_symbols
+ x = Symbol.all_symbols
+ assert_kind_of(Array, x)
+ assert_empty(x.reject {|s| s.is_a?(Symbol) })
+ end
+
def test_inspect_invalid
# 2) Symbol#inspect sometimes returns invalid symbol representations:
assert_eval_inspected(:"!")