Sha256: 28bbd08f1bf3e56c180cacf21c7823d072a90609e8b6dbcb0a7740802bbcf6c4

Contents?: true

Size: 1.08 KB

Versions: 50

Compression:

Stored size: 1.08 KB

Contents

# -*- coding: utf-8 -*-

class Foo
end

class TestGetTextBind < Test::Unit::TestCase
  def setup
    GetText.locale = "ja_JP.EUC-JP"
    @dumped_all_text_domains = GetText::TextDomainManager.dump_all_text_domains
    GetText::TextDomainManager.clear_all_text_domains
  end

  def teardown
    GetText::TextDomainManager.restore_all_text_domains(@dumped_all_text_domains)
  end

  def test_bindtextdomain
    domain = GetText.bindtextdomain("foo")
    assert_equal domain, GetText::TextDomainManager.create_or_find_text_domain_group(Object).text_domains[0]
    assert_equal domain, GetText::TextDomainManager.text_domain_pool("foo")
  end

  def test_textdomain
    domain1 = GetText.bindtextdomain("foo")

    assert_equal domain1, GetText.textdomain("foo")

    assert_raise(GetText::NoboundTextDomainError) {
      GetText.textdomain_to(Foo, "bar")
    }
  end

  def test_textdomain_to
    domain1 = GetText.bindtextdomain("foo")

    assert_equal domain1, GetText.textdomain_to(Foo, "foo")

    assert_raise(GetText::NoboundTextDomainError) {
      GetText.textdomain_to(Foo, "bar")
    }
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
gettext-3.4.9 test/test_text_domain_bind.rb
gettext-3.4.8 test/test_text_domain_bind.rb
gettext-3.4.7 test/test_text_domain_bind.rb
gettext-3.4.6 test/test_text_domain_bind.rb
gettext-3.4.5 test/test_text_domain_bind.rb
gettext-3.4.4 test/test_text_domain_bind.rb
gettext-3.4.3 test/test_text_domain_bind.rb
gettext-3.4.2 test/test_text_domain_bind.rb
gettext-3.4.1 test/test_text_domain_bind.rb
gettext-3.4.0 test/test_text_domain_bind.rb
gettext-3.3.9 test/test_text_domain_bind.rb
gettext-3.3.8 test/test_text_domain_bind.rb
gettext-3.3.7 test/test_text_domain_bind.rb
gettext-3.3.6 test/test_text_domain_bind.rb
gettext-3.3.5 test/test_text_domain_bind.rb
gettext-3.3.4 test/test_text_domain_bind.rb
gettext-3.3.3 test/test_text_domain_bind.rb
gettext-3.3.2 test/test_text_domain_bind.rb
gettext-3.3.1 test/test_text_domain_bind.rb
gettext-3.3.0 test/test_text_domain_bind.rb