Sha256: d659bcda0a32da960dd9f126512241a5ebca9173c9922a8783e0060502285324

Contents?: true

Size: 1.26 KB

Versions: 17

Compression:

Stored size: 1.26 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

17 entries across 17 versions & 2 rubygems

Version Path
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/twitter_cldr-4.4.5/spec/tokenizers/calendars/datetime_tokenizer_spec.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/twitter_cldr-4.4.5/spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-4.4.5 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-4.4.4 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-4.4.3 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-4.4.2 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-4.4.1 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-4.4.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-4.3.1 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-4.3.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-4.2.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-4.1.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-4.0.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-3.6.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-3.5.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-3.4.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb
twitter_cldr-3.3.0 spec/tokenizers/calendars/datetime_tokenizer_spec.rb