Sha256: 6a18d59bf2e0fca989ba2245721136051e41d904d17899a4bf38b65854f4b976

Contents?: true

Size: 766 Bytes

Versions: 86

Compression:

Stored size: 766 Bytes

Contents

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

class TerminalTest < Test::Unit::TestCase
  def test_terminal?
    rule = Terminal.new
    assert(rule.terminal?)
  end

  def test_eql?
    rule = Terminal.new(/abc/i)
    assert_equal(rule, /abc/i)
  end

  def test_exec
    rule = Terminal.new(/\d+/)
    events = rule.exec(Input.new('123'))
    assert_equal([rule, CLOSE, 3], events)
  end

  def test_exec_long
    rule = Terminal.new(/\d+/)
    events = rule.exec(Input.new('123 456'))
    assert_equal([rule, CLOSE, 3], events)
  end

  def test_exec_miss
    rule = Terminal.new(/\d+/)
    events = rule.exec(Input.new(' 123'))
    assert_equal([], events)
  end

  def test_to_s
    rule = Terminal.new(/\d+/)
    assert_equal('/\\d+/', rule.to_s)
  end
end

Version data entries

86 entries across 86 versions & 2 rubygems

Version Path
harbr-2.8.1 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/terminal_test.rb
harbr-0.2.10 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/terminal_test.rb
harbr-0.2.9 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/terminal_test.rb
harbr-0.2.8 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/terminal_test.rb
harbr-0.2.7 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/terminal_test.rb
harbr-0.2.6 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/terminal_test.rb
harbr-0.2.5 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/terminal_test.rb
harbr-0.2.4 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/terminal_test.rb
harbr-0.2.3 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/terminal_test.rb
harbr-0.2.2 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/terminal_test.rb
harbr-0.2.1 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/terminal_test.rb
harbr-0.2.0 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/terminal_test.rb
harbr-0.1.99 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/terminal_test.rb
harbr-0.1.98 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/terminal_test.rb
harbr-0.1.97 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/terminal_test.rb
harbr-0.1.96 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/terminal_test.rb
harbr-0.1.95 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/terminal_test.rb
harbr-0.1.94 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/terminal_test.rb
harbr-0.1.93 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/terminal_test.rb
harbr-0.1.91 vendor/bundle/ruby/3.2.0/gems/citrus-3.0.2/test/terminal_test.rb