зеркало из https://github.com/github/ruby.git
test/test-unicode_normalize.rb: added test_us_ascii.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
4fda619836
Коммит
96d375540f
|
@ -1,3 +1,7 @@
|
|||
Sat Oct 25 20:19:19 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
|
||||
|
||||
* test/test-unicode_normalize.rb: added test_us_ascii.
|
||||
|
||||
Sat Oct 25 20:09:09 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
|
||||
|
||||
* lib/unicode_normalize/normalize.rb: added US_ASCII
|
||||
|
|
|
@ -154,4 +154,23 @@ class TestNormalize < Test::Unit::TestCase
|
|||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче