Sha256: 6ff733a68fce6138887fb0e26772c9fdff7041103f0b4d58ed72a96dd0184526

Contents?: true

Size: 747 Bytes

Versions: 6

Compression:

Stored size: 747 Bytes

Contents

# encoding: utf-8

require 'gettext/runtime/mo'

class TestMo < 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_false(mo.has_key?("untranslated"))
    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::MO.open("locale/ja/LC_MESSAGES/#{file}", "UTF-8")
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gettext-2.3.9 test/test_mo.rb
gettext-2.3.8 test/test_mo.rb
gettext-2.3.7 test/test_mo.rb
gettext-2.3.6 test/test_mo.rb
gettext-2.3.5 test/test_mo.rb
gettext-2.3.4 test/test_mo.rb