summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/ruby/test_module.rb3
-rw-r--r--test/ruby/test_parse.rb20
-rw-r--r--test/ruby/test_symbol.rb13
3 files changed, 16 insertions, 20 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 1171e3bc84..9c5ec6032a 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -826,6 +826,9 @@ class TestModule < Test::Unit::TestCase
c.class_eval('@@foo = :foo')
c.class_eval { remove_class_variable(:@@foo) }
assert_equal(false, c.class_variable_defined?(:@@foo))
+ assert_raise(NameError) do
+ c.class_eval { remove_class_variable(:@var) }
+ end
end
def test_export_method
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index 216cdc083b..80d09c1e7b 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -839,26 +839,6 @@ x = __ENCODING__
end
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_is_class_id
- c = Class.new
- assert_raise(NameError) do
- c.instance_eval { remove_class_variable(:@var) }
- end
- end
-
def test_method_block_location
bug5614 = '[ruby-core:40936]'
expected = nil
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(:"!")