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