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

ruby-changes:36051

From: duerst <ko1@a...>
Date: Sat, 25 Oct 2014 20:01:11 +0900 (JST)
Subject: [ruby-changes:36051] duerst:r48132 (trunk): test/test-unicode_normalize.rb: added test_raise_exception_for_non_unicode_encoding.

duerst	2014-10-25 20:01:05 +0900 (Sat, 25 Oct 2014)

  New Revision: 48132

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

  Log:
    test/test-unicode_normalize.rb: added test_raise_exception_for_non_unicode_encoding.

  Modified files:
    trunk/ChangeLog
    trunk/test/test_unicode_normalize.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48131)
+++ ChangeLog	(revision 48132)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Oct 25 20:01:01 2014  Martin Duerst <duerst@i...>
+
+	* test/test-unicode_normalize.rb: added
+	  test_raise_exception_for_non_unicode_encoding.
+
 Sat Oct 25 19:30:30 2014  Martin Duerst <duerst@i...>
 
 	* test/test-unicode_normalize.rb: removed unused function.
Index: test/test_unicode_normalize.rb
===================================================================
--- test/test_unicode_normalize.rb	(revision 48131)
+++ test/test_unicode_normalize.rb	(revision 48132)
@@ -148,4 +148,10 @@ class TestNormalize < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/test_unicode_normalize.rb#L148
     assert_equal "\u1100\u1161\u0323\u0300", "\uAC00\u0300\u0323".unicode_normalize(:nfd)
     assert_equal "\u1100\u1161\u0323\u0300", "\u1100\u1161\u0300\u0323".unicode_normalize(:nfd)
   end
+  
+  def test_raise_exception_for_non_unicode_encoding
+    assert_raise(Encoding::CompatibilityError) { "abc".force_encoding('ISO-8859-1').unicode_normalize }
+    assert_raise(Encoding::CompatibilityError) { "abc".force_encoding('ISO-8859-1').unicode_normalize! }
+    assert_raise(Encoding::CompatibilityError) { "abc".force_encoding('ISO-8859-1').unicode_normalized? }
+  end
 end

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

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