Sha256: 92be38931048ec534aa69fce8ad863455a909909cc3f4149fbf42e5bac8dc96a

Contents?: true

Size: 991 Bytes

Versions: 2

Compression:

Stored size: 991 Bytes

Contents

#!ruby19
# encoding: utf-8

require File.dirname(__FILE__) + '/spec_helper'
require 'simply_useful/java_native2ascii'

class JavaNative2AsciiHelper
  def native_ascii_pairs
    [
      ["foo=ęéëèAZ中文", "foo=\\u0119\\u00e9\\u00eb\\u00e8AZ\\u4e2d\\u6587"],
      ["foo=\304\231", "foo=\\u0119"],
      ["bar=bbzz", "bar=bbzz"]
    ] # Believe me! Those characters are there (even if they are not in your fontset!
  end
end

describe SimplyUseful::JavaNative2Ascii do
  before(:all) do
    @helper = JavaNative2AsciiHelper.new
  end
  
  it "should convert from ascii to native" do
    @helper.native_ascii_pairs.each do |native_ascii|
      native,ascii = native_ascii
      SimplyUseful::JavaNative2Ascii.ascii2native(ascii).should == native
    end
  end
  
  it "should convert from native to ascii" do
    @helper.native_ascii_pairs.each do |native_ascii|
      native,ascii = native_ascii
      SimplyUseful::JavaNative2Ascii.native2ascii(native).should == ascii
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simply_useful-0.2.1 spec/java_native2ascii_spec.rb
simply_useful-0.2.0 spec/java_native2ascii_spec.rb