Sha256: 9c245deb32524047dcd5e569e3baf195ff6c9a983d8b2e91d2fb126e3ff2e990

Contents?: true

Size: 718 Bytes

Versions: 1

Compression:

Stored size: 718 Bytes

Contents

# -*- coding: utf-8 -*-
require 'spec_helper'

describe Ting do
  let(:pinyin)   { 'dao4 ke3 dao4 fei1 chang2 dao4'.force_encoding('UTF-8') }
  let(:bopomofo) { 'ㄉㄠˋ ㄎㄜˇ ㄉㄠˋ ㄈㄟ ㄔㄤˊ ㄉㄠˋ'.force_encoding('UTF-8') }

  it 'should convert from Hany Pinyin to Bopomofo' do
    expect(Ting.from(:hanyu, :numbers).to(:zhuyin, :marks).convert(pinyin)).to eq(bopomofo)
  end

  it 'should parse' do
    expect(Ting::Reader.new(:hanyu, :numbers).parse('Bei3').first).to eq(Ting::Syllable.new( Ting::Initial::Bo, Ting::Final::Ei, 3, true ))
  end

  it 'should respect capitalization' do
    expect(Ting.from(:hanyu, :numbers).to(:hanyu, :accents).convert('Bei3 jing1')).to eq('Běi jīng')
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ting-0.10.0 spec/ting_spec.rb