Sha256: 40542b3c92f24d75992c554ea0a0738b7660db333e5fe08564e5099a6e74506d

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

Stored size: 1.34 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) { 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

3 entries across 3 versions & 1 rubygems

Version Path
twitter_cldr-3.0.2 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-3.0.1 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-3.0.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb