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