Sha256: 002ac67dc96f485336d4f7dfa6fffc4f43632bff7cf9a862eb60fe758e228472

Contents?: true

Size: 1.47 KB

Versions: 18

Compression:

Stored size: 1.47 KB

Contents

#!ruby19
# encoding: utf-8

require File.expand_path("#{File.dirname(__FILE__)}/../spec_helper")

# Require ActiveSupport for multibyte strings
begin
  require 'active_support'
rescue
  gem 'activesupport'
  require 'active_support'
end

module MultibyteCharsSpec
  describe "an anything symbol" do
    testing_expression '.'
    it "matches an UTF-8 character" do
      parse_multibyte("ø").should_not be_nil
    end
  end
  
  describe "A character class containing UTF-8 characters" do
    testing_expression "[æøå]"
    it "recognizes the UTF-8 characters" do
      parse_multibyte("ø").should_not be_nil
    end
  end
  
  describe "a character class repetition containing UTF-8 characters mixed with other expressions" do
    testing_expression '[æøå]+ "a"'
    it "lazily instantiates a node for the character" do
      result = parse_multibyte('æøåa')
      pending "Multibyte support is not supported in Ruby 1.8.6" if RUBY_VERSION =~ /^1\.8.6/
      result.elements[0].instance_variable_get("@elements").should include(true)
      result.elements[0].elements.should_not include(true)
      result.elements[0].elements.size.should == 3
      result.elements.size.should == 2
      result.elements[0].text_value.should == "æøå"
      result.elements[0].elements[0].text_value.should == "æ"
      result.elements[0].elements[1].text_value.should == "ø"
      result.elements[0].elements[2].text_value.should == "å"
      result.elements[1].text_value == "a"
    end
  end
  
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mail-2.1.3 lib/mail/vendor/treetop-1.4.3/spec/compiler/multibyte_chars_spec.rb
mail-2.1.2 lib/mail/vendor/treetop-1.4.3/spec/compiler/multibyte_chars_spec.rb
mail-2.1.1 lib/mail/vendor/treetop-1.4.3/spec/compiler/multibyte_chars_spec.rb
mail-2.1.0 lib/mail/vendor/treetop-1.4.3/spec/compiler/multibyte_chars_spec.rb
mail-2.0.5 lib/mail/vendor/treetop-1.4.3/spec/compiler/multibyte_chars_spec.rb
mail-2.0.3 lib/mail/vendor/treetop-1.4.3/spec/compiler/multibyte_chars_spec.rb
mail-1.6.0 lib/mail/vendor/treetop-1.4.3/spec/compiler/multibyte_chars_spec.rb
mail-1.5.4 lib/mail/vendor/treetop-1.4.3/spec/compiler/multibyte_chars_spec.rb
mail-1.5.3 lib/mail/vendor/treetop-1.4.3/spec/compiler/multibyte_chars_spec.rb
mail-1.5.2 lib/mail/vendor/treetop-1.4.3/spec/compiler/multibyte_chars_spec.rb
mail-1.5.1 lib/mail/vendor/treetop-1.4.3/spec/compiler/multibyte_chars_spec.rb
mail-1.5.0 lib/mail/vendor/treetop-1.4.3/spec/compiler/multibyte_chars_spec.rb
mail-1.4.3 lib/mail/vendor/treetop-1.4.3/spec/compiler/multibyte_chars_spec.rb
mail-1.4.2 lib/vendor/treetop-1.4.3/spec/compiler/multibyte_chars_spec.rb
mail-1.4.1 lib/vendor/treetop-1.4.3/spec/compiler/multibyte_chars_spec.rb
mail-1.4.0 lib/vendor/treetop-1.4.3/spec/compiler/multibyte_chars_spec.rb
mail-1.3.5 lib/vendor/treetop-1.4.3/spec/compiler/multibyte_chars_spec.rb
mail-1.3.4 lib/vendor/treetop-1.4.3/spec/compiler/multibyte_chars_spec.rb