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

ruby-changes:33369

From: nobu <ko1@a...>
Date: Thu, 27 Mar 2014 18:08:57 +0900 (JST)
Subject: [ruby-changes:33369] nobu:r45448 (trunk): test_m17n_comb.rb: refine assertions

nobu	2014-03-27 18:08:51 +0900 (Thu, 27 Mar 2014)

  New Revision: 45448

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

  Log:
    test_m17n_comb.rb: refine assertions
    
    * test/ruby/test_m17n_comb.rb (test_str_scan): refine assertion
      messages.

  Modified files:
    trunk/test/ruby/test_m17n_comb.rb
Index: test/ruby/test_m17n_comb.rb
===================================================================
--- test/ruby/test_m17n_comb.rb	(revision 45447)
+++ test/ruby/test_m17n_comb.rb	(revision 45448)
@@ -1036,25 +1036,26 @@ class TestM17NComb < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_m17n_comb.rb#L1036
 
   def test_str_scan
     combination(STRINGS, STRINGS) {|s1, s2|
+      desc = proc {"#{s1.dump}.scan(#{s2.dump})"}
       if !s2.valid_encoding?
-        assert_raise(RegexpError) { s1.scan(s2) }
+        assert_raise(RegexpError, desc) { s1.scan(s2) }
         next
       end
       if !s1.ascii_only? && !s2.ascii_only? && s1.encoding != s2.encoding
         if s1.valid_encoding?
-          assert_raise(Encoding::CompatibilityError) { s1.scan(s2) }
+          assert_raise(Encoding::CompatibilityError, desc) { s1.scan(s2) }
         else
-          assert_match(/invalid byte sequence/, assert_raise(ArgumentError) { s1.scan(s2) }.message)
+          assert_raise_with_message(ArgumentError, /invalid byte sequence/, desc) { s1.scan(s2) }
         end
         next
       end
       if !s1.valid_encoding?
-        assert_raise(ArgumentError) { s1.scan(s2) }
+        assert_raise(ArgumentError, desc) { s1.scan(s2) }
         next
       end
       r = enccall(s1, :scan, s2)
       r.each {|t|
-        assert_equal(s2, t)
+        assert_equal(s2, t, desc)
       }
     }
   end

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

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