Sha256: ec7782144ac3e60e5ed109f7febb7338283033a4ea969ad94040af23fea0918c

Contents?: true

Size: 831 Bytes

Versions: 5

Compression:

Stored size: 831 Bytes

Contents

# encoding: UTF-8

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

require 'spec_helper'

include TwitterCldr::Parsers

describe UnicodeRegexParser::UnicodeString do
  describe "#to_set" do
    it "should return a zero-length range when representing a single codepoint" do
      str = UnicodeRegexParser::UnicodeString.new([97])
      expect(str.to_set.to_a).to eq([97..97])
    end

    it "should return a range containing the codepoint array as both the first and last elements" do
      str = UnicodeRegexParser::UnicodeString.new([97, 98, 99])
      expect(str.to_set.to_a).to eq([[97, 98, 99]..[97, 98, 99]])
    end

    it "should covert the codepoints to a valid regex" do
      str = UnicodeRegexParser::UnicodeString.new(97)
      expect(str.to_regexp_str).to eq"(?:\\141)"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
twitter_cldr-3.1.1 spec/parsers/unicode_regex/unicode_string_spec.rb
twitter_cldr-3.1.0 spec/parsers/unicode_regex/unicode_string_spec.rb
twitter_cldr-3.0.10 spec/parsers/unicode_regex/unicode_string_spec.rb
twitter_cldr-3.0.9 spec/parsers/unicode_regex/unicode_string_spec.rb
twitter_cldr-3.0.8 spec/parsers/unicode_regex/unicode_string_spec.rb