Sha256: b1f69063bec646e5a456f7e75ce9952349708a631a7bd90e7898f05886ca0f30

Contents?: true

Size: 1.21 KB

Versions: 8

Compression:

Stored size: 1.21 KB

Contents

# encoding: UTF-8

require 'locale/tag'
require 'locale/taglist'
require 'test/unit'

class TestTagList < Test::Unit::TestCase
  def test_taglist_posix
    list = Locale::TagList.new([Locale::Tag.parse("ja_JP.eucJP@mobile"), 
				Locale::Tag.parse("en_US.iso8859-1")])

    assert_equal "ja", list.language
    assert_equal "JP", list.region
    assert_equal "eucJP", list.charset
    assert_equal "mobile", list.modifier
    assert_equal "ja_JP.eucJP@mobile", list.to_s
    assert_equal Locale::Tag::Common.parse("ja_JP_mobile"), list.to_common
    assert_equal Locale::Tag::Rfc.parse("ja-JP-mobile"), list.to_rfc
    assert_equal Locale::Tag::Cldr.parse("ja_JP_mobile"), list.to_cldr
    assert_equal Locale::Tag::Posix.parse("ja_JP.eucJP@mobile"), list.to_posix
    assert_equal Locale::Tag::Posix.parse("en_US.iso8859-1"), list[1]
  end

  def test_taglist_rfc
    list = Locale::TagList.new([Locale::Tag.parse("ja-Hira-JP-MOBILE-y-aaa-x-bbb"), 
				Locale::Tag.parse("en-US-mobile")])
    assert_equal "ja", list.language
    assert_equal "Hira", list.script
    assert_equal "JP", list.region
    assert_equal ["MOBILE"], list.variants
    assert_equal ["y-aaa"], list.extensions
    assert_equal "x-bbb", list.privateuse
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
locale-2.0.8 test/test_taglist.rb
locale-2.0.7 test/test_taglist.rb
locale-2.0.6 test/test_taglist.rb
locale-2.0.5 test/test_taglist.rb
locale-2.0.3 test/test_taglist.rb
locale-2.0.4 test/test_taglist.rb
locale-2.0.2 test/test_taglist.rb
locale-2.0.1 test/test_taglist.rb