require 'test/unit' require 'rockit/grammar' include Rockit class UTestRule < Test::Unit::TestCase def test_01_empty_rule r = Rule.new(:r1, []) assert_equal(:r1, r.name) assert_equal([], r.right_hand_side) end def test_02 r = Rule.new(:r1, [[:a, "B"]]) assert_equal(:r1, r.name) assert_equal(2, r.right_hand_side.length) s1, s2 = r.right_hand_side assert_kind_of(NonTerminal, s1) assert_kind_of(StringTerminal, s2) assert_equal(:a, s1.symbol) assert_equal("B", s2.string) end end