Sha256: 67a72e0a54dfa2453bf22595ebfe9401cfd9225a9fc7286f384a19e2750d7a14

Contents?: true

Size: 1.25 KB

Versions: 27

Compression:

Stored size: 1.25 KB

Contents

# encoding: UTF-8

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

require 'spec_helper'

describe TwitterCldr::Tokenizers::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

27 entries across 27 versions & 1 rubygems

Version Path
twitter_cldr-6.12.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-6.11.5 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-6.11.4 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-6.11.3 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-6.11.2 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-6.11.1 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-6.11.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-6.10.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-6.9.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-6.8.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-6.7.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-6.6.2 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-6.6.1 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-6.6.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-6.5.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-6.4.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-6.3.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-6.2.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-6.1.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-6.0.2 spec/tokenizers/calendars/datetime_tokenizer_spec.rb