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

ruby-changes:36054

From: duerst <ko1@a...>
Date: Sat, 25 Oct 2014 20:19:30 +0900 (JST)
Subject: [ruby-changes:36054] duerst:r48135 (trunk): test/test-unicode_normalize.rb: added test_us_ascii.

duerst	2014-10-25 20:19:22 +0900 (Sat, 25 Oct 2014)

  New Revision: 48135

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

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

  Modified files:
    trunk/ChangeLog
    trunk/test/test_unicode_normalize.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48134)
+++ ChangeLog	(revision 48135)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Oct 25 20:19:19 2014  Martin Duerst <duerst@i...>
+
+	* test/test-unicode_normalize.rb: added test_us_ascii.
+
 Sat Oct 25 20:09:09 2014  Martin Duerst <duerst@i...>
 
 	* lib/unicode_normalize/normalize.rb: added US_ASCII
Index: test/test_unicode_normalize.rb
===================================================================
--- test/test_unicode_normalize.rb	(revision 48134)
+++ test/test_unicode_normalize.rb	(revision 48135)
@@ -154,4 +154,23 @@ class TestNormalize < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/test_unicode_normalize.rb#L154
     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
+
+  def test_us_ascii
+    ascii_string = 'abc'.encode('US-ASCII')
+
+    assert_equal ascii_string, ascii_string.unicode_normalize
+    assert_equal ascii_string, ascii_string.unicode_normalize(:nfd)
+    assert_equal ascii_string, ascii_string.unicode_normalize(:nfkc)
+    assert_equal ascii_string, ascii_string.unicode_normalize(:nfkd)
+
+    assert_equal ascii_string, ascii_string.unicode_normalize!
+    assert_equal ascii_string, ascii_string.unicode_normalize!(:nfd)
+    assert_equal ascii_string, ascii_string.unicode_normalize!(:nfkc)
+    assert_equal ascii_string, ascii_string.unicode_normalize!(:nfkd)
+
+    assert_equal true, ascii_string.unicode_normalized?
+    assert_equal true, ascii_string.unicode_normalized?(:nfd)
+    assert_equal true, ascii_string.unicode_normalized?(:nfkc)
+    assert_equal true, ascii_string.unicode_normalized?(:nfkd)
+  end
 end

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

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