Sha256: aabbff1e9111c495205c6a66b7315b6727df4e4f92b90202ab3348e82d2a9e4d

Contents?: true

Size: 1.48 KB

Versions: 13

Compression:

Stored size: 1.48 KB

Contents

# encoding: UTF-8

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

require 'spec_helper'

include TwitterCldr::Tokenizers

describe DateTokenizer do
  describe "#tokens" do
    it "should tokenize a time string correctly (i.e. German)" do
      tokenizer = TimeTokenizer.new(:locale => :de)
      got       = tokenizer.tokens(:type => :full)
      expected  = [
          { :value => "HH", :type => :pattern },
          { :value => ":", :type => :plaintext },
          { :value => "mm", :type => :pattern },
          { :value => ":", :type => :plaintext },
          { :value => "ss", :type => :pattern },
          { :value => " ", :type => :plaintext },
          { :value => "zzzz", :type => :pattern }
      ]
      check_token_list(got, expected)
    end

    it "should tokenize patterns with non-latin characters correctly (i.e. Korean)" do
      tokenizer = TimeTokenizer.new(:locale => :ko)
      got       = tokenizer.tokens(:type => :full)
      expected  = [
          { :value => "a", :type => :pattern },
          { :value => " ", :type => :plaintext },
          { :value => "h", :type => :pattern },
          { :value => "시 ", :type => :plaintext },
          { :value => "m", :type => :pattern },
          { :value => "분 ", :type => :plaintext },
          { :value => "s", :type => :pattern },
          { :value => "초 ", :type => :plaintext },
          { :value => "zzzz", :type => :pattern }
      ]
      check_token_list(got, expected)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
twitter_cldr-1.9.1 spec/tokenizers/calendars/time_tokenizer_spec.rb
twitter_cldr-1.9.0 spec/tokenizers/calendars/time_tokenizer_spec.rb
twitter_cldr-1.8.1 spec/tokenizers/calendars/time_tokenizer_spec.rb
twitter_cldr-1.8.0 spec/tokenizers/calendars/time_tokenizer_spec.rb
twitter_cldr-1.7.0 spec/tokenizers/calendars/time_tokenizer_spec.rb
twitter_cldr-1.6.2 spec/tokenizers/calendars/time_tokenizer_spec.rb
twitter_cldr-1.6.1 spec/tokenizers/calendars/time_tokenizer_spec.rb
twitter_cldr-1.6.0 spec/tokenizers/calendars/time_tokenizer_spec.rb
twitter_cldr-1.5.0 spec/tokenizers/calendars/time_tokenizer_spec.rb
twitter_cldr-1.4.1 spec/tokenizers/calendars/time_tokenizer_spec.rb
twitter_cldr-1.4.0 spec/tokenizers/calendars/time_tokenizer_spec.rb
twitter_cldr-1.3.6 spec/tokenizers/calendars/time_tokenizer_spec.rb
twitter_cldr-1.3.0 spec/tokenizers/calendars/time_tokenizer_spec.rb