[前][次][番号順一覧][スレッド一覧]

ruby-changes:32300

From: nobu <ko1@a...>
Date: Tue, 24 Dec 2013 16:13:40 +0900 (JST)
Subject: [ruby-changes:32300] nobu:r44379 (trunk): assertions.rb: assert_throw

nobu	2013-12-24 16:13:35 +0900 (Tue, 24 Dec 2013)

  New Revision: 44379

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44379

  Log:
    assertions.rb: assert_throw
    
    * lib/test/unit/assertions.rb (assert_throw): make an alias of
      assert_throws.

  Modified files:
    trunk/lib/test/unit/assertions.rb
    trunk/test/ruby/test_object.rb
Index: lib/test/unit/assertions.rb
===================================================================
--- lib/test/unit/assertions.rb	(revision 44378)
+++ lib/test/unit/assertions.rb	(revision 44379)
@@ -191,12 +191,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/lib/test/unit/assertions.rb#L191
       #    assert_throw(tag, "#{tag} was not thrown!") do
       #      throw tag
       #    end
-      def assert_throw(tag, msg = nil)
-        catch(tag) do
-          yield(tag)
-          assert(false, message(msg) {"Expected #{mu_pp(tag)} to have been thrown"})
-        end
-      end
+      alias assert_throw assert_throws
 
       # :call-seq:
       #   assert_equal( expected, actual, failure_message = nil )
Index: test/ruby/test_object.rb
===================================================================
--- test/ruby/test_object.rb	(revision 44378)
+++ test/ruby/test_object.rb	(revision 44379)
@@ -29,8 +29,8 @@ class TestObject < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_object.rb#L29
     end
 
     obj = cls.new
-    assert_throws(:initialize_clone) {obj.clone}
-    assert_throws(:initialize_dup) {obj.dup}
+    assert_throw(:initialize_clone) {obj.clone}
+    assert_throw(:initialize_dup) {obj.dup}
   end
 
   def test_instance_of

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]