Sha256: 610dd15f9eb335cd35c22118ede9479d98a0ff8ed47dd11e0a36e5dd8c877753

Contents?: true

Size: 765 Bytes

Versions: 7

Compression:

Stored size: 765 Bytes

Contents

require File.dirname(__FILE__) + '/helper'

class FixedWidthTest < Test::Unit::TestCase

  def test_terminal?
    rule = FixedWidth.new
    assert(rule.terminal?)
  end

  def test_match
    rule = FixedWidth.new('abc')
    match = rule.match(input('abc'))
    assert(match)
    assert_equal('abc', match.text)
    assert_equal(3, match.length)
  end

  def test_match_short
    rule = FixedWidth.new('abc')
    match = rule.match(input('ab'))
    assert_equal(nil, match)
  end

  def test_match_long
    rule = FixedWidth.new('abc')
    match = rule.match(input('abcd'))
    assert(match)
    assert_equal('abc', match.text)
    assert_equal(3, match.length)
  end

  def test_to_s
    rule = FixedWidth.new('abc')
    assert_equal('"abc"', rule.to_s)
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
citrus-1.4.0 test/fixed_width_test.rb
citrus-1.3.0 test/fixed_width_test.rb
citrus-1.2.2 test/fixed_width_test.rb
citrus-1.2.1 test/fixed_width_test.rb
citrus-1.2.0 test/fixed_width_test.rb
citrus-1.1.0 test/fixed_width_test.rb
citrus-1.0.0 test/fixed_width_test.rb