Sha256: c42b4ac1a9a8a62a48b23aa041c3dc29caec6aaffc66fa119d45255c746d0085

Contents?: true

Size: 915 Bytes

Versions: 3

Compression:

Stored size: 915 Bytes

Contents

require 'test/unit'

require 'gettext.rb'
include GetText

bindtextdomain("test1", "locale")
module Mod
  module_function
  def module_function
    _("language")
  end
end

class Cls
  def instance_method
    _("language")
  end
  def self.class_method
    _("language")
  end
end

def toplevel_method
  _("language")
end

class TestGetText < Test::Unit::TestCase
  include GetText

  def test_toplevel
    GetText.locale = "ja"
    assert_equal("japanese", toplevel_method)
    assert_equal("japanese", Mod.module_function)
    assert_equal("japanese", Cls.class_method)
    assert_equal("japanese", Cls.new.instance_method)

    GetText.remove_all_textdomains
    GetText.bindtextdomain("test1", "locale")
    assert_equal("japanese", toplevel_method)
    assert_equal("japanese", Mod.module_function)
    assert_equal("japanese", Cls.class_method)
    assert_equal("japanese", Cls.new.instance_method)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gettext-1.91.0 test/test_gettext_toplevel.rb
gettext-1.92.0 test/test_gettext_toplevel.rb
gettext-1.93.0 test/test_gettext_toplevel.rb