Sha256: 2735927e146bebea8efdd3929d0a9da9b41069130f9f8f16064e1bbb365d6099

Contents?: true

Size: 894 Bytes

Versions: 5

Compression:

Stored size: 894 Bytes

Contents

# encoding: utf-8

require "spec_helper"

module ICU
  describe Transliteration::Transliterator do

    def transliterator_for(*args)
      Transliteration::Transliterator.new(*args)
    end

    [
      ["Any-Hex", "abcde", "\\u0061\\u0062\\u0063\\u0064\\u0065"],
      ["Lower", "ABC", "abc"]
    ].each do |id, input, output|
      it "should transliterate #{id}" do
        tl = transliterator_for(id)
        tl.transliterate(input).should == 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

5 entries across 5 versions & 1 rubygems

Version Path
ffi-icu-0.1.2 spec/transliteration_spec.rb
ffi-icu-0.1.1 spec/transliteration_spec.rb
ffi-icu-0.1.0 spec/transliteration_spec.rb
ffi-icu-0.0.9 spec/transliteration_spec.rb
ffi-icu-0.0.8 spec/transliteration_spec.rb