ruby-changes:36397
From: nobu <ko1@a...>
Date: Wed, 19 Nov 2014 00:11:09 +0900 (JST)
Subject: [ruby-changes:36397] nobu:r48478 (trunk): test_exception.rb: missing test
nobu 2014-11-19 00:11:03 +0900 (Wed, 19 Nov 2014) New Revision: 48478 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48478 Log: test_exception.rb: missing test * test/ruby/test_exception.rb (test_name_error_info): add missing test of NoMethodError and NameError. Modified files: trunk/test/ruby/test_exception.rb Index: test/ruby/test_exception.rb =================================================================== --- test/ruby/test_exception.rb (revision 48477) +++ test/ruby/test_exception.rb (revision 48478) @@ -656,4 +656,21 @@ end.join https://github.com/ruby/ruby/blob/trunk/test/ruby/test_exception.rb#L656 def test_anonymous_message assert_in_out_err([], "raise Class.new(RuntimeError), 'foo'", [], /foo\n/) end + + def test_name_error_info + obj = BasicObject.new + e = assert_raise(NameError) { + obj.instance_eval("Object") + } + assert_equal(:Object, e.name) + e = assert_raise(NameError) { + obj.instance_eval {foo} + } + assert_equal(:foo, e.name) + e = assert_raise(NoMethodError) { + obj.foo(1, 2) + } + assert_equal(:foo, e.name) + assert_equal([1, 2], e.args) + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/