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
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/twitter_cldr-4.4.5/spec/shared/casefolder_spec.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/twitter_cldr-4.4.5/spec/shared/casefolder_spec.rb
twitter_cldr-4.4.5 spec/shared/casefolder_spec.rb
twitter_cldr-4.4.4 spec/shared/casefolder_spec.rb
twitter_cldr-4.4.3 spec/shared/casefolder_spec.rb
twitter_cldr-4.4.2 spec/shared/casefolder_spec.rb
twitter_cldr-4.4.1 spec/shared/casefolder_spec.rb
twitter_cldr-4.4.0 spec/shared/casefolder_spec.rb
twitter_cldr-4.3.1 spec/shared/casefolder_spec.rb
twitter_cldr-4.3.0 spec/shared/casefolder_spec.rb
twitter_cldr-4.2.0 spec/shared/casefolder_spec.rb
twitter_cldr-4.1.0 spec/shared/casefolder_spec.rb
twitter_cldr-4.0.0 spec/shared/casefolder_spec.rb
twitter_cldr-3.6.0 spec/shared/casefolder_spec.rb
twitter_cldr-3.5.0 spec/shared/casefolder_spec.rb
twitter_cldr-3.4.0 spec/shared/casefolder_spec.rb
twitter_cldr-3.3.0 spec/shared/casefolder_spec.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/twitter_cldr-3.2.1/spec/shared/casefolder_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/twitter_cldr-3.2.1/spec/shared/casefolder_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/twitter_cldr-3.1.2/spec/shared/casefolder_spec.rb