Sha256: a1a55a90b43fd5a41d76d1802d6aea79bb9c2082fa549b3ad8e9c642844633eb

Contents?: true

Size: 535 Bytes

Versions: 1

Compression:

Stored size: 535 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rockit-0.7.1 tests/unit/rockit/utest_rule.rb