Sha256: b86fde15079a663a12e8160fdaf485ed7ceab37c92b3de16c443a6701c6f30af

Contents?: true

Size: 938 Bytes

Versions: 2

Compression:

Stored size: 938 Bytes

Contents

# encoding: utf-8

require 'testlib/helper.rb'

class Foo
end

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

  def test_bindtextdomain
    domain = GetText.bindtextdomain("foo")
    assert_equal domain, GetText::TextDomainManager.create_or_find_textdomain_group(Object).textdomains[0]
    assert_equal domain, GetText::TextDomainManager.textdomain_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

2 entries across 2 versions & 2 rubygems

Version Path
gettext-2.2.0 test/test_textdomain_bind.rb
ofm_gettext-2.0.1 test/test_textdomain_bind.rb