Sha256: d12dc35b39d1127348daabe812e3ec6cf6a0b34f15c0b0204802c385b87fa957

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

# encoding: utf-8

require "spec_helper"

module ICU
  describe Transliteration::Transliterator do

    def transliterator(*args)
      @t = Transliteration::Transliterator.new(*args)
    end

    after { @t.close if @t }

    [
     { :id => "Any-Hex",     :input => "abcde",  :output => "\\u0061\\u0062\\u0063\\u0064\\u0065"  },
     { :id => "Lower",       :input => "ABC",    :output => "abc"                                  },
    ].each do |test|

      it "should transliterate #{test[:id]}" do
        transliterator(test[:id]).transliterate(test[:input]).should == test[:output]
      end

    end
  end # Transliterator

  describe Transliteration do
    it "should provide a list of available ids" do
      ids = ICU::Transliteration.available_ids
      ids.should be_kind_of(Array)
      ids.should_not be_empty
    end

   it "should transliterate custom rules" do
     ICU::Transliteration.translit("NFD; [:Nonspacing Mark:] Remove; NFC", "âêîôû").should == "aeiou"
   end

  end # Transliteration
end # ICU

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ffi-icu-0.0.5 spec/transliteration_spec.rb