indented.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f4f7c3db4f
commit
614619031b
@ -2,15 +2,15 @@ require 'test/unit'
|
||||
|
||||
module Emoji
|
||||
|
||||
class TestRenameSJIS < Test::Unit::TestCase
|
||||
class TestRenameSJIS < Test::Unit::TestCase
|
||||
def test_shift_jis
|
||||
assert_raise(ArgumentError) { "".force_encoding("Shift_JIS-DoCoMo") }
|
||||
assert_raise(ArgumentError) { "".force_encoding("Shift_JIS-KDDI") }
|
||||
assert_raise(ArgumentError) { "".force_encoding("Shift_JIS-SoftBank") }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class TestUTF8_BLACK_SUN_WITH_RAYS < Test::Unit::TestCase
|
||||
class TestUTF8_BLACK_SUN_WITH_RAYS < Test::Unit::TestCase
|
||||
include Emoji
|
||||
|
||||
def setup
|
||||
@ -30,9 +30,9 @@ class TestUTF8_BLACK_SUN_WITH_RAYS < Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class TestDoCoMo < Test::Unit::TestCase
|
||||
class TestDoCoMo < Test::Unit::TestCase
|
||||
include Emoji
|
||||
|
||||
def setup
|
||||
@ -112,9 +112,9 @@ class TestDoCoMo < Test::Unit::TestCase
|
||||
assert_raise(Encoding::UndefinedConversionError) { to_utf8_softbank(@sjis_docomo_only) }
|
||||
assert_raise(Encoding::UndefinedConversionError) { to_sjis_softbank(@sjis_docomo_only) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class TestKDDI < Test::Unit::TestCase
|
||||
class TestKDDI < Test::Unit::TestCase
|
||||
include Emoji
|
||||
|
||||
def setup
|
||||
@ -238,9 +238,9 @@ class TestKDDI < Test::Unit::TestCase
|
||||
assert_raise(Encoding::UndefinedConversionError) { assert_equal @utf8_softbank, to_utf8_softbank(@iso2022jp_kddi_only) }
|
||||
assert_raise(Encoding::UndefinedConversionError) { assert_equal @sjis_softbank, to_sjis_softbank(@iso2022jp_kddi_only) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class TestSoftBank < Test::Unit::TestCase
|
||||
class TestSoftBank < Test::Unit::TestCase
|
||||
include Emoji
|
||||
|
||||
def setup
|
||||
@ -320,11 +320,11 @@ class TestSoftBank < Test::Unit::TestCase
|
||||
assert_raise(Encoding::UndefinedConversionError) { to_sjis_kddi(@sjis_softbank_only) }
|
||||
assert_raise(Encoding::UndefinedConversionError) { to_iso2022jp_kddi(@sjis_softbank_only) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
private
|
||||
|
||||
def setup_instance_variable(obj)
|
||||
def setup_instance_variable(obj)
|
||||
obj.instance_eval do
|
||||
@aiueo_utf8 = "\u{3042}\u{3044}\u{3046}\u{3048}\u{304A}"
|
||||
@aiueo_sjis = to_sjis(@aiueo_utf8)
|
||||
@ -353,90 +353,90 @@ def setup_instance_variable(obj)
|
||||
@utf8_softbank_only = utf8_softbank("\u{E524}")
|
||||
@sjis_softbank_only = sjis_softbank("\xFB\xC4")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def utf8(str)
|
||||
def utf8(str)
|
||||
str.force_encoding("UTF-8")
|
||||
end
|
||||
end
|
||||
|
||||
def to_utf8(str)
|
||||
def to_utf8(str)
|
||||
str.encode("UTF-8")
|
||||
end
|
||||
end
|
||||
|
||||
def to_sjis(str)
|
||||
def to_sjis(str)
|
||||
str.encode("Windows-31J")
|
||||
end
|
||||
end
|
||||
|
||||
def to_eucjp(str)
|
||||
def to_eucjp(str)
|
||||
str.encode("eucJP-ms")
|
||||
end
|
||||
end
|
||||
|
||||
def to_iso2022jp(str)
|
||||
def to_iso2022jp(str)
|
||||
str.encode("ISO-2022-JP")
|
||||
end
|
||||
end
|
||||
|
||||
def utf8_docomo(str)
|
||||
def utf8_docomo(str)
|
||||
str.force_encoding("UTF8-DoCoMo")
|
||||
end
|
||||
end
|
||||
|
||||
def to_utf8_docomo(str)
|
||||
def to_utf8_docomo(str)
|
||||
str.encode("UTF8-DoCoMo")
|
||||
end
|
||||
end
|
||||
|
||||
def utf8_kddi(str)
|
||||
def utf8_kddi(str)
|
||||
str.force_encoding("UTF8-KDDI")
|
||||
end
|
||||
end
|
||||
|
||||
def to_utf8_kddi(str)
|
||||
def to_utf8_kddi(str)
|
||||
str.encode("UTF8-KDDI")
|
||||
end
|
||||
end
|
||||
|
||||
def utf8_softbank(str)
|
||||
def utf8_softbank(str)
|
||||
str.force_encoding("UTF8-SoftBank")
|
||||
end
|
||||
end
|
||||
|
||||
def to_utf8_softbank(str)
|
||||
def to_utf8_softbank(str)
|
||||
str.encode("UTF8-SoftBank")
|
||||
end
|
||||
end
|
||||
|
||||
def sjis_docomo(str)
|
||||
def sjis_docomo(str)
|
||||
str.force_encoding("SJIS-DoCoMo")
|
||||
end
|
||||
end
|
||||
|
||||
def to_sjis_docomo(str)
|
||||
def to_sjis_docomo(str)
|
||||
str.encode("SJIS-DoCoMo")
|
||||
end
|
||||
end
|
||||
|
||||
def sjis_kddi(str)
|
||||
def sjis_kddi(str)
|
||||
str.force_encoding("SJIS-KDDI")
|
||||
end
|
||||
end
|
||||
|
||||
def to_sjis_kddi(str)
|
||||
def to_sjis_kddi(str)
|
||||
str.encode("SJIS-KDDI")
|
||||
end
|
||||
end
|
||||
|
||||
def sjis_softbank(str)
|
||||
def sjis_softbank(str)
|
||||
str.force_encoding("SJIS-SoftBank")
|
||||
end
|
||||
end
|
||||
|
||||
def to_sjis_softbank(str)
|
||||
def to_sjis_softbank(str)
|
||||
str.encode("SJIS-SoftBank")
|
||||
end
|
||||
end
|
||||
|
||||
def iso2022jp_kddi(str)
|
||||
def iso2022jp_kddi(str)
|
||||
str.force_encoding("ISO-2022-JP-KDDI")
|
||||
end
|
||||
end
|
||||
|
||||
def to_iso2022jp_kddi(str)
|
||||
def to_iso2022jp_kddi(str)
|
||||
str.encode("ISO-2022-JP-KDDI")
|
||||
end
|
||||
end
|
||||
|
||||
def stateless_iso2022jp_kddi(str)
|
||||
def stateless_iso2022jp_kddi(str)
|
||||
str.force_encoding("stateless-ISO-2022-JP-KDDI")
|
||||
end
|
||||
end
|
||||
|
||||
def to_stateless_iso2022jp_kddi(str)
|
||||
def to_stateless_iso2022jp_kddi(str)
|
||||
str.encode("stateless-ISO-2022-JP-KDDI")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user