class MockMLGetText

Public Instance Methods

test_all(t) click to toggle source
# File vendor/qwik/lib/qwik/ml-gettext.rb, line 92
def test_all(t)
  # $KCODE = 's'

  # test_set_catalog
  cf = QuickML::CatalogFactory.new
  cf.load_all_here('catalog-ml-??.rb')
  catalog_ja = cf.get_catalog('ja')
  set_catalog(catalog_ja)

  # test before set catalog
  @catalog          = nil
  @message_charset  = nil
  set_catalog(nil)
  set_charset(nil)
  t.is 'hello', gettext('hello')
  t.is "Info: a\n", gettext("Info: %s\n", 'a')
  t.is "If you agree, then,\n", gettext("If you agree, then,\n")

  # test_codeconv
  t.is 'あ', codeconv('あ')

  # test after set catalog
  @catalog          = catalog_ja
  @message_charset  = 'iso-2022-jp'
  set_catalog(catalog_ja)
  set_charset('iso-2022-jp')
  t.is 'こんにちは'.set_sourcecode_charset.to_mail_charset, gettext('hello')
  t.is 'こんにちは'.set_sourcecode_charset.to_mail_charset, _('hello')
  t.is 'こんにちは'.set_sourcecode_charset.to_mail_charset, gettext2('hello')
  t.is 'こんにちは'.set_sourcecode_charset.to_mail_charset, gettext('hello')
  t.is "使い方: a\n".set_sourcecode_charset.to_mail_charset, gettext("Info: %s\n", 'a')
  t.is "もし承認する場合、\n".set_sourcecode_charset.to_mail_charset,
    gettext("If you agree, then,\n")

  # test_codeconv_ja
  t.is "\e$B$\"\e(B", codeconv('あ')
end