File: test_mofile.rb

package info (click to toggle)
ruby-gettext 2.2.1-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,648 kB
  • sloc: ruby: 4,445; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 532 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# encoding: utf-8

require 'testlib/helper.rb'
require 'gettext/runtime/mofile'

class TestMoFile < Test::Unit::TestCase
  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