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.70 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.69 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.68 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.67 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.66 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.65 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.64 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.63 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.62 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.61 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.60 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.59 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.58 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.57 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.56 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.55 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.54 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.53 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.52 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb
harbr-0.1.50 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/multibyte_test.rb