Sha256: 3139bd908e024f909ef1c909afbd6646ff36e9ab64e7f576a50c266b66764d06

Contents?: true

Size: 1023 Bytes

Versions: 34

Compression:

Stored size: 1023 Bytes

Contents

# encoding: UTF-8

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

require 'spec_helper'

include TwitterCldr::Shared

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

    it "should correctly casefold the Turkic i character" do
      expect(Casefolder.casefold("Istanbul", true)).to eq("ıstanbul")
      expect(Casefolder.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(Casefolder.casefold(text)).to eq(expected)
    end
  end
end

Version data entries

34 entries across 34 versions & 3 rubygems

Version Path
twitter_cldr-3.2.1 spec/shared/casefolder_spec.rb
twitter_cldr-3.2.0 spec/shared/casefolder_spec.rb
twitter_cldr-3.1.2 spec/shared/casefolder_spec.rb
twitter_cldr-3.1.1 spec/shared/casefolder_spec.rb
twitter_cldr-3.1.0 spec/shared/casefolder_spec.rb
twitter_cldr-3.0.10 spec/shared/casefolder_spec.rb
twitter_cldr-3.0.9 spec/shared/casefolder_spec.rb
twitter_cldr-3.0.8 spec/shared/casefolder_spec.rb
twitter_cldr-3.0.7 spec/shared/casefolder_spec.rb
twitter_cldr-3.0.6 spec/shared/casefolder_spec.rb
twitter_cldr-3.0.5 spec/shared/casefolder_spec.rb
twitter_cldr-3.0.4 spec/shared/casefolder_spec.rb
twitter_cldr-3.0.3 spec/shared/casefolder_spec.rb
twitter_cldr-3.0.2 spec/shared/casefolder_spec.rb