Sha256: 9e220ea6b1518068effbd14b0ac50236fcf501c6ff3d88191f4cf879b76eee41

Contents?: true

Size: 698 Bytes

Versions: 1

Compression:

Stored size: 698 Bytes

Contents

# coding: utf-8

require 'test_helper'

include IRCSupport::Encoding

describe "Encoding" do
  utf8 = "lúði"
  cp1252 = "l\xFA\xF0i"

  it "should decode correctly" do
    if %w{jruby rbx}.include?(RUBY_ENGINE)
      skip("Encoding support is incomplete on rbx and jruby")
    end
    decode_irc(utf8).must_equal utf8
    decode_irc(utf8, 'UTF-8').must_equal utf8
    decode_irc(cp1252).must_equal utf8
  end

  it "should encode correctly" do
    if %w{jruby rbx}.include?(RUBY_ENGINE)
      skip("Encoding support is incomplete on rbx and jruby")
    end
    encode_irc(utf8).bytes.to_a.must_equal cp1252.bytes.to_a
    encode_irc(utf8, 'UTF-8').bytes.to_a.must_equal utf8.bytes.to_a
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ircsupport-0.1.0 test/encoding_test.rb