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

ruby-changes:40298

From: nobu <ko1@a...>
Date: Fri, 30 Oct 2015 12:03:05 +0900 (JST)
Subject: [ruby-changes:40298] nobu:r52379 (trunk): test_object.rb: add more checks

nobu	2015-10-30 12:02:14 +0900 (Fri, 30 Oct 2015)

  New Revision: 52379

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

  Log:
    test_object.rb: add more checks
    
    * test/ruby/test_object.rb (test_remove_instance_variable): refine
      failure message and check the name.

  Modified files:
    trunk/test/ruby/test_object.rb
Index: test/ruby/test_object.rb
===================================================================
--- test/ruby/test_object.rb	(revision 52378)
+++ test/ruby/test_object.rb	(revision 52379)
@@ -236,17 +236,19 @@ class TestObject < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_object.rb#L236
       'T_CLASS,T_MODULE' => Class.new(Object),
       'generic ivar' => '',
     }.each do |desc, o|
-      assert_raises(NameError, "#{desc} iv removal raises before set") do
+      e = assert_raise(NameError, "#{desc} iv removal raises before set") do
         o.remove_instance_variable(:@foo)
       end
+      assert_equal([o, :@foo], [e.receiver, e.name])
       o.instance_eval { @foo = :foo }
       assert_equal(:foo, o.remove_instance_variable(:@foo),
                    "#{desc} iv removal returns original value")
-      assert_equal(false, o.instance_variable_defined?(:@foo),
-                   "#{desc} iv removed succesfully")
-      assert_raises(NameError, "#{desc} iv removal raises after removal") do
+      assert_not_send([o, :instance_variable_defined?, :@foo],
+                      "#{desc} iv removed succesfully")
+      e = assert_raise(NameError, "#{desc} iv removal raises after removal") do
         o.remove_instance_variable(:@foo)
       end
+      assert_equal([o, :@foo], [e.receiver, e.name])
     end
   end
 

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

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