Sha256: 0e7c243e231534c20e4dd21e0b10074420310049175aa04cf78abc079ca1ea3c

Contents?: true

Size: 1.36 KB

Versions: 15

Compression:

Stored size: 1.36 KB

Contents

# encoding: UTF-8

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

require 'spec_helper'

include TwitterCldr::Tokenizers

describe DateTimeTokenizer do
  let(:data_reader) { TwitterCldr::DataReaders::DateTimeDataReader.new(:es, :type => :full) }
  let(:tokenizer) { data_reader.tokenizer }

  describe "#tokenize" do
    it "should expand date and time placeholders and return the correct list of tokens" do
      got = tokenizer.tokenize(data_reader.pattern)
      expected  = [
        { :value => "EEEE", :type => :pattern },
        { :value => ", ", :type => :plaintext },
        { :value => "d", :type => :pattern },
        { :value => " 'de' ", :type => :plaintext },
        { :value => "MMMM", :type => :pattern },
        { :value => " 'de' ", :type => :plaintext },
        { :value => "y", :type => :pattern },
        { :value => ",", :type => :plaintext },
        { :value => " ", :type => :plaintext },
        { :value => "H", :type => :pattern },
        { :value => ":", :type => :plaintext },
        { :value => "mm", :type => :pattern },
        { :value => ":", :type => :plaintext },
        { :value => "ss", :type => :pattern },
        { :value => " (", :type => :plaintext },
        { :value => "zzzz", :type => :pattern },
        { :value => ")", :type => :plaintext }
      ]
      check_token_list(got, expected)
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/twitter_cldr-3.2.1/spec/tokenizers/calendars/datetime_tokenizer_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/twitter_cldr-3.2.1/spec/tokenizers/calendars/datetime_tokenizer_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/twitter_cldr-3.1.2/spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-3.2.1 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-3.2.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-3.1.2 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-3.1.1 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-3.1.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-3.0.10 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-3.0.9 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-3.0.8 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-3.0.7 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-3.0.6 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-3.0.5 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-3.0.4 spec/tokenizers/calendars/datetime_tokenizer_spec.rb