Sha256: 599c33c964127a6e9109ba5a5c4d6a2ab229a11e4bf7af67733ef3d54b438a33

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

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"]
    assert_equal "english", hash["en-US"]
    assert_equal "french",  hash["fr-FR"]
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/iso639-1.3.2/test/insensitive_hash_test.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/iso639-1.3.2/test/insensitive_hash_test.rb
iso639-1.3.2 test/insensitive_hash_test.rb