ruby-changes:31132
From: nobu <ko1@a...>
Date: Wed, 9 Oct 2013 17:41:20 +0900 (JST)
Subject: [ruby-changes:31132] nobu:r43211 (trunk): test: use assert_raise
nobu 2013-10-09 17:41:13 +0900 (Wed, 09 Oct 2013) New Revision: 43211 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43211 Log: test: use assert_raise * test/ruby, test/-ext-: use assert_raise instead of assert_raises. Modified files: trunk/test/-ext-/tracepoint/test_tracepoint.rb trunk/test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb trunk/test/ruby/test_file.rb trunk/test/ruby/test_hash.rb trunk/test/ruby/test_module.rb trunk/test/ruby/test_thread.rb Index: test/ruby/test_module.rb =================================================================== --- test/ruby/test_module.rb (revision 43210) +++ test/ruby/test_module.rb (revision 43211) @@ -248,7 +248,7 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_module.rb#L248 ":", ["String::", "[Bug #7573]"], ].each do |name, msg| - e = assert_raises(NameError, "#{msg}#{': ' if msg}wrong constant name #{name.dump}") { + e = assert_raise(NameError, "#{msg}#{': ' if msg}wrong constant name #{name.dump}") { Object.const_get name } assert_equal("wrong constant name %s" % name, e.message) @@ -296,7 +296,7 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_module.rb#L296 end def test_nested_bad_class - assert_raises(TypeError) do + assert_raise(TypeError) do self.class.const_get([User, 'USER', 'Foo'].join('::')) end end @@ -1656,7 +1656,7 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_module.rb#L1656 @@foo $foo ].each do |name| - assert_raises(NameError) do + assert_raise(NameError) do Module.new { attr_accessor name.to_sym } end end Index: test/ruby/test_file.rb =================================================================== --- test/ruby/test_file.rb (revision 43210) +++ test/ruby/test_file.rb (revision 43211) @@ -339,7 +339,7 @@ class TestFile < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file.rb#L339 end def test_file_open_double_mode - e = assert_raises(ArgumentError) { File.open("a", 'w', :mode => 'rw+') } + e = assert_raise(ArgumentError) { File.open("a", 'w', :mode => 'rw+') } assert_equal 'mode specified twice', e.message end Index: test/ruby/test_hash.rb =================================================================== --- test/ruby/test_hash.rb (revision 43210) +++ test/ruby/test_hash.rb (revision 43211) @@ -99,7 +99,7 @@ class TestHash < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_hash.rb#L99 super(Object.new) end }.new - assert_raises(TypeError) { h.dup } + assert_raise(TypeError) { h.dup } end def test_clear_initialize_copy Index: test/ruby/test_thread.rb =================================================================== --- test/ruby/test_thread.rb (revision 43210) +++ test/ruby/test_thread.rb (revision 43211) @@ -83,7 +83,7 @@ class TestThread < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_thread.rb#L83 def test_thread_variable_frozen t = Thread.new { }.join t.freeze - assert_raises(RuntimeError) do + assert_raise(RuntimeError) do t.thread_variable_set(:foo, "bar") end end @@ -748,13 +748,13 @@ _eom https://github.com/ruby/ruby/blob/trunk/test/ruby/test_thread.rb#L748 end def test_thread_join_current - assert_raises(ThreadError) do + assert_raise(ThreadError) do Thread.current.join end end def test_thread_join_main_thread - assert_raises(ThreadError) do + assert_raise(ThreadError) do Thread.new(Thread.current) {|t| t.join }.join Index: test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb =================================================================== --- test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb (revision 43210) +++ test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb (revision 43211) @@ -27,7 +27,7 @@ class TestWaitForSingleFD < Test::Unit:: https://github.com/ruby/ruby/blob/trunk/test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb#L27 with_pipe do |r,w| wfd = w.fileno w.close - assert_raises(Errno::EBADF) do + assert_raise(Errno::EBADF) do IO.wait_for_single_fd(wfd, RB_WAITFD_OUT, nil) end end Index: test/-ext-/tracepoint/test_tracepoint.rb =================================================================== --- test/-ext-/tracepoint/test_tracepoint.rb (revision 43210) +++ test/-ext-/tracepoint/test_tracepoint.rb (revision 43211) @@ -3,7 +3,7 @@ require '-test-/tracepoint' https://github.com/ruby/ruby/blob/trunk/test/-ext-/tracepoint/test_tracepoint.rb#L3 class TestTracepointObj < Test::Unit::TestCase def test_not_available_from_ruby - assert_raises ArgumentError do + assert_raise ArgumentError do TracePoint.trace(:obj_new){} end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/