Sha256: 716ee22830502cc1ea465bfd740d91a2707eb8be42faf45b2a4fdbe711d0534a

Contents?: true

Size: 985 Bytes

Versions: 4

Compression:

Stored size: 985 Bytes

Contents

require "test_helper"

describe Iso639::InsensitiveHash do
  it "should return results ignoring case" do
    hash = Iso639::InsensitiveHash.new
    hash["foo"] = "one thing"
    hash["Bar"] = "another thing"
    hash["BAZ"] = "last thing"

    assert_equal "one thing",     hash["FOO"]
    assert_equal "another thing", hash["bar"]
    assert_equal "last thing",    hash["baz"]
  end

  it "should return results ignoring whitespace" do
    hash = Iso639::InsensitiveHash.new
    hash[" foo \t"] = "one thing"
    hash["Bar"] = "another thing"
    hash["\tBAZ\n"] = "last thing"

    assert_equal "one thing",     hash["FOO"]
    assert_equal "another thing", hash["  bar \t"]
    assert_equal "last thing",    hash["baz"]
  end

  it "should return results ignoring regional designators" do
    hash = Iso639::InsensitiveHash.new
    hash["en_GB"] = "english"
    hash["fr_CA"] = "french"

    assert_equal "english", hash["en_US"]
    assert_equal "french",  hash["fr_FR"]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
iso639-1.3.1 test/insensitive_hash_test.rb
iso639-1.3.0 test/insensitive_hash_test.rb
iso639-1.2.1 test/insensitive_hash_test.rb
iso639-1.2.0 test/insensitive_hash_test.rb