Sha256: c79e556d6732ae137d731df4dbf6dbb81ba6bada616532086447dea870afeb58

Contents?: true

Size: 713 Bytes

Versions: 1

Compression:

Stored size: 713 Bytes

Contents

# encoding: utf-8

require 'gettext/runtime/mofile'

class TestMoFile < Test::Unit::TestCase
  def test_not_exist_msgid
    mo = load_mo("_.mo")
    assert_equal(nil, mo["notexistent"])
  end

  def test_untranslated
    mo = load_mo("untranslated.mo")
    assert_equal(nil, mo["untranslated"])
  end

  def test_non_ascii
    mo = load_mo("non_ascii.mo")
    assert_equal("Hello in Japanese", mo["こんにちは"])
  end

  def test_backslash
    mo = load_mo("backslash.mo")
    assert_equal("'\\'は'\\\\'とエスケープするべきです。",
                 mo["You should escape '\\' as '\\\\'."])
  end

  def load_mo(file)
    GetText::MoFile.open("locale/ja/LC_MESSAGES/#{file}", "UTF-8")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gettext-2.3.1 test/test_mofile.rb