Sha256: e81dfb2666d1062db08c676ee2eedf14b2d205cd664e249840cfe689a9b7280b

Contents?: true

Size: 765 Bytes

Versions: 1

Compression:

Stored size: 765 Bytes

Contents

#coding : utf-8
require 'test/unit'

require './lib/xsd/iconvcharset'

module XSD

  class TestIconvCharset < Test::Unit::TestCase
    def test_normal_ascii
      test = "abcdefghijklmnopqrsut"
      assert_equal test, IconvCharset.safe_iconv('cp932', 'utf-8', test)
    end
    def test_utf8
      test = "\xff\xfe1\0\x16\x202\0"
      assert_equal "1‖2", IconvCharset.safe_iconv('utf-8', 'utf-16', test)
    end
    def test_illegal
      test = "abcde\xff\xfefghijklmnopqr\x80sut"
      assert_equal "abcde??fghijklmnopqr?sut", IconvCharset.safe_iconv('utf-8', 'cp932', test)
    end
    def test_undef
      test = "\xff\xfe1\0\x16\x202\0".encode('utf-8', 'utf-16')
      assert_equal "1?2", IconvCharset.safe_iconv('cp932', 'utf-8', test)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
soap4r-r19-1.5.9 test/test_iconvcharset.rb