ruby-changes:38521
From: nobu <ko1@a...>
Date: Fri, 22 May 2015 21:10:58 +0900 (JST)
Subject: [ruby-changes:38521] nobu:r50602 (trunk): test_parse.rb: move assertions
nobu 2015-05-22 21:10:52 +0900 (Fri, 22 May 2015) New Revision: 50602 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50602 Log: 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. Modified files: trunk/test/ruby/test_module.rb trunk/test/ruby/test_parse.rb trunk/test/ruby/test_symbol.rb Index: test/ruby/test_module.rb =================================================================== --- test/ruby/test_module.rb (revision 50601) +++ test/ruby/test_module.rb (revision 50602) @@ -826,6 +826,9 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_module.rb#L826 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 Index: test/ruby/test_symbol.rb =================================================================== --- test/ruby/test_symbol.rb (revision 50601) +++ test/ruby/test_symbol.rb (revision 50602) @@ -12,6 +12,19 @@ class TestSymbol < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_symbol.rb#L12 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(:"!") Index: test/ruby/test_parse.rb =================================================================== --- test/ruby/test_parse.rb (revision 50601) +++ test/ruby/test_parse.rb (revision 50602) @@ -839,26 +839,6 @@ x = __ENCODING__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L839 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/