test/string_terminal_test.rb in citrus-2.2.2 vs test/string_terminal_test.rb in citrus-2.3.0
- old
+ new
@@ -4,14 +4,19 @@
def test_terminal?
rule = StringTerminal.new
assert(rule.terminal?)
end
+ def test_eql?
+ rule = StringTerminal.new('abc')
+ assert_equal('abc', rule)
+ end
+
def test_exec
rule = StringTerminal.new('abc')
events = rule.exec(Input.new('abc'))
- assert_equal([rule.id, CLOSE, 3], events)
+ assert_equal([rule, CLOSE, 3], events)
end
def test_exec_miss
rule = StringTerminal.new('abc')
events = rule.exec(Input.new('def'))
@@ -25,23 +30,23 @@
end
def test_exec_long
rule = StringTerminal.new('abc')
events = rule.exec(Input.new('abcd'))
- assert_equal([rule.id, CLOSE, 3], events)
+ assert_equal([rule, CLOSE, 3], events)
end
def test_exec_case_insensitive
rule = StringTerminal.new('abc', Regexp::IGNORECASE)
events = rule.exec(Input.new('abc'))
- assert_equal([rule.id, CLOSE, 3], events)
+ assert_equal([rule, CLOSE, 3], events)
events = rule.exec(Input.new('ABC'))
- assert_equal([rule.id, CLOSE, 3], events)
+ assert_equal([rule, CLOSE, 3], events)
events = rule.exec(Input.new('Abc'))
- assert_equal([rule.id, CLOSE, 3], events)
+ assert_equal([rule, CLOSE, 3], events)
end
def test_to_s
rule = StringTerminal.new('abc')
assert_equal('"abc"', rule.to_s)