Sha256: 221a3740c41dd9688f234397d0fdc2389c96e0d43e6b20f2d67129db588b51f8

Contents?: true

Size: 893 Bytes

Versions: 1

Compression:

Stored size: 893 Bytes

Contents

require_relative 'test_helper.rb'
require 'minitest/autorun'
require 'diachronr'

class DiachronrTest < Minitest::Test
  def test_should_create_a_rule
    r = Diachronr::Rule.new 'a//_'
    assert_equal r.to_s, "'a' > '' / '_'"
  end

  def test_apply_simple_rule
    r = Diachronr::Rule.new 'a//_'
    assert_equal r.apply('taco'), 'tco'
  end

  def test_apply_condition
    r = Diachronr::Rule.new 'a/b/d_e'
    assert_equal r.apply('daetat'), 'dbetat'
  end

  def test_apply_word_boundry
    r = Diachronr::Rule.new 'a/e/_#'
    assert_equal r.apply('data'), 'date'
  end

  def test_apply_rewrite
    r = Diachronr::Rewrite.new 'dh|ð'
    assert_equal r.apply('edhel'), 'eðel'
  end

  def test_apply_ruleset
    r = Diachronr::RuleSet.load 'test/fixtures/seonic_to_varag.yml'
    r.options['seonic'].each do |seonic, varag|
      assert_equal r.apply(seonic), varag
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
diachronr-1.0.0 test/diachronr_test.rb