Sha256: bf1e4e5bedf497190d83a5c05d8c736214469451189d549e6e0d3159c326fd0c

Contents?: true

Size: 938 Bytes

Versions: 1

Compression:

Stored size: 938 Bytes

Contents

require 'test/unit'

require 'rockit/grammar'
include Rockit

require 'strscan'

class UTestStringTerminal < Test::Unit::TestCase
  def setup
    @sta = StringTerminal.new("a")
    @stp = StringTerminal.new("+")
  end

  def test_01_smoke
    assert_kind_of(StringTerminal, @sta)
    assert_kind_of(GrammarSymbol, @sta)
    assert_kind_of(StringTerminal, @stp)
    assert_kind_of(GrammarSymbol, @stp)
  end

  def test_02_inspect
    assert_kind_of(String, @sta.inspect)
    assert_equal("a", @sta.inspect)
  end

  def test_03_string
    assert_kind_of(String, @sta.string)
    assert_equal("a", @sta.string)
    assert_kind_of(String, @stp.string) 
    assert_equal("+", @stp.string)
  end

  def test_04_regexp
    assert_kind_of(Regexp, @sta.regexp)
    assert_equal(/\s*(a)/, @sta.regexp)
    assert_kind_of(Regexp, @stp.regexp)
    assert_equal(/\s*(\+)/, @stp.regexp)
    assert_equal("/\\s*(\\+)/", @stp.regexp.inspect)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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