Sha256: 332c091bc5a2535374b650c2c741440e81815c29c2324bb9c0593ef61fcc47bf

Contents?: true

Size: 1016 Bytes

Versions: 2

Compression:

Stored size: 1016 Bytes

Contents

# encoding: utf-8

include GetText

bindtextdomain("test1", :path => "locale")
module TopLevelModule
  module_function
  def module_function
    _("language")
  end
end

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

def toplevel_method
  _("language")
end

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

  def teardown
    GetText.locale = nil
  end

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

    GetText.bindtextdomain("test1", :path => "locale")
    assert_equal("japanese", toplevel_method)
    assert_equal("japanese", TopLevelModule.module_function)
    assert_equal("japanese", TopLevelClass.class_method)
    assert_equal("japanese", TopLevelClass.new.instance_method)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gettext-2.3.9 test/test_textdomain_toplevel.rb
gettext-2.3.8 test/test_textdomain_toplevel.rb