Sha256: f821e662693381e19e8a2ad7c5c6f130f0d16a0d09a965829d54f1acdc3af49e

Contents?: true

Size: 1.32 KB

Versions: 83

Compression:

Stored size: 1.32 KB

Contents

# encoding: UTF-8

require File.expand_path('../helper', __FILE__)

class MultibyteTest < Test::Unit::TestCase
  grammar :Multibyte do
    rule :string do
      "ä"
    end

    rule :regexp do
      /(ä)+/
    end

    rule :character_class do
      /[ä]+/
    end

    rule :dot do
      DOT
    end
  end

  def test_multibyte_string
    m = Multibyte.parse("ä", :root => :string)
    assert(m)
  end

  def test_multibyte_regexp
    m = Multibyte.parse("äää", :root => :regexp)
    assert(m)
  end

  def test_multibyte_character_class
    m = Multibyte.parse("äää", :root => :character_class)
    assert(m)
  end

  def test_multibyte_dot
    m = Multibyte.parse("ä", :root => :dot)
    assert(m)
  end

  Citrus.eval(<<-CITRUS)
  grammar Multibyte2
    rule string
      "ä"
    end

    rule regexp
      /(ä)+/
    end

    rule character_class
      [ä]+
    end

    rule dot
      .+
    end
  end
  CITRUS

  def test_multibyte2_string
    m = Multibyte2.parse("ä", :root => :string)
    assert(m)
  end

  def test_multibyte2_regexp
    m = Multibyte2.parse("äää", :root => :regexp)
    assert(m)
  end

  def test_multibyte2_character_class
    m = Multibyte2.parse("äää", :root => :character_class)
    assert(m)
  end

  def test_multibyte2_dot
    m = Multibyte2.parse("äää", :root => :dot)
    assert(m)
  end
end

Version data entries

83 entries across 83 versions & 2 rubygems

Version Path
harbr-0.1.90 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.89 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.88 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.87 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.86 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.85 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.84 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.83 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.82 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.81 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.80 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.79 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.78 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.77 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.76 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.75 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.74 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.73 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.72 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.71 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb