mirror of
https://github.com/ruby/ruby.git
synced 2025-09-20 19:14:00 +02:00
* test/iconv/test_{basic,option}.rb, test/iconv/utils.rb: added.
* test/iconv/test_partial.rb: renamed from test_simple.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
28c5fe3c6c
commit
b35b33c751
5 changed files with 143 additions and 27 deletions
22
test/iconv/utils.rb
Normal file
22
test/iconv/utils.rb
Normal file
|
@ -0,0 +1,22 @@
|
|||
begin
|
||||
require 'iconv'
|
||||
rescue LoadError
|
||||
else
|
||||
require 'test/unit'
|
||||
end
|
||||
|
||||
class TestIconv < Test::Unit::TestCase
|
||||
if defined?(::Encoding) and String.method_defined?(:force_encoding)
|
||||
def self.encode(str, enc)
|
||||
str.force_encoding(enc)
|
||||
end
|
||||
else
|
||||
def self.encode(str, enc)
|
||||
str
|
||||
end
|
||||
end
|
||||
|
||||
ASCII = "ascii"
|
||||
EUCJ_STR = encode("\xa4\xa2\xa4\xa4\xa4\xa6\xa4\xa8\xa4\xaa", "EUC-JP").freeze
|
||||
SJIS_STR = encode("\x82\xa0\x82\xa2\x82\xa4\x82\xa6\x82\xa8", "Shift_JIS").freeze
|
||||
end if defined?(::Iconv)
|
Loading…
Add table
Add a link
Reference in a new issue