Sha256: 0d9a65664e714a70c3152c81e4760f354effccdbab186bdd9a53b672d5efe500

Contents?: true

Size: 1.02 KB

Versions: 27

Compression:

Stored size: 1.02 KB

Contents

# encoding: UTF-8

# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0

require 'spec_helper'

describe TwitterCldr::Shared::Casefolder do
  describe "#casefold" do
    it "should casefold a few canonical examples" do
      expect(described_class.casefold("Weißrussland")).to eq("weissrussland")
      expect(described_class.casefold("Hello, World")).to eq("hello, world")
    end

    it "should correctly casefold the Turkic i character" do
      expect(described_class.casefold("Istanbul", true)).to eq("ıstanbul")
      expect(described_class.casefold("İstanbul", true)).to eq("istanbul")
    end

    # the files used in this test come from the unicode_utils gem
    it "should casefold a large block of text and exactly match the expected text" do
      base_path = File.dirname(__FILE__)
      text = File.read(File.join(base_path, "casefolding.txt"))
      expected = File.read(File.join(base_path, "casefolding_expected.txt"))
      expect(described_class.casefold(text)).to eq(expected)
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
twitter_cldr-6.12.0 spec/shared/casefolder_spec.rb
twitter_cldr-6.11.5 spec/shared/casefolder_spec.rb
twitter_cldr-6.11.4 spec/shared/casefolder_spec.rb
twitter_cldr-6.11.3 spec/shared/casefolder_spec.rb
twitter_cldr-6.11.2 spec/shared/casefolder_spec.rb
twitter_cldr-6.11.1 spec/shared/casefolder_spec.rb
twitter_cldr-6.11.0 spec/shared/casefolder_spec.rb
twitter_cldr-6.10.0 spec/shared/casefolder_spec.rb
twitter_cldr-6.9.0 spec/shared/casefolder_spec.rb
twitter_cldr-6.8.0 spec/shared/casefolder_spec.rb
twitter_cldr-6.7.0 spec/shared/casefolder_spec.rb
twitter_cldr-6.6.2 spec/shared/casefolder_spec.rb
twitter_cldr-6.6.1 spec/shared/casefolder_spec.rb
twitter_cldr-6.6.0 spec/shared/casefolder_spec.rb
twitter_cldr-6.5.0 spec/shared/casefolder_spec.rb
twitter_cldr-6.4.0 spec/shared/casefolder_spec.rb
twitter_cldr-6.3.0 spec/shared/casefolder_spec.rb
twitter_cldr-6.2.0 spec/shared/casefolder_spec.rb
twitter_cldr-6.1.0 spec/shared/casefolder_spec.rb
twitter_cldr-6.0.2 spec/shared/casefolder_spec.rb