Sha256: b1ab257ced156e710fda0015bc8c48a7971e96619dc0c6f1147f6542123ca6e6

Contents?: true

Size: 776 Bytes

Versions: 30

Compression:

Stored size: 776 Bytes

Contents

require 'test/unit'
require 'stringio'
require 'rscm/parser'

module RSCM
  class ParserTest < Test::Unit::TestCase
  
    class TestParser < Parser
      def initialize
        super(/^-+$/)
        @result = ""
      end
    
    protected

      def parse_line(line)
        @result << line
      end
      
      def next_result
        r = @result
        @result = ""
        r
      end
    end
  
    def test_can_parse_until_line_inclusive
      parser = TestParser.new
      io = StringIO.new(TEST_DATA)
      parser.parse(io) {|line|}
      assert_equal("one\ntwo\n", parser.parse(io))
      assert_equal("three\nfour\n", parser.parse(io))
    end

TEST_DATA = <<EOF
bla bla
--
one
two
--
three
four
--
EOF

  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
rscm-0.1.0.1338 test/rscm/parser_test.rb
rscm-0.1.0.1337 test/rscm/parser_test.rb
rscm-0.1.0.999 test/rscm/parser_test.rb
rscm-0.3.4 test/rscm/parser_test.rb
rscm-0.3.0 test/rscm/parser_test.rb
rscm-0.3.5 test/rscm/parser_test.rb
rscm-0.3.2 test/rscm/parser_test.rb
rscm-0.3.15 test/rscm/parser_test.rb
rscm-0.3.1 test/rscm/parser_test.rb
rscm-0.3.11 test/rscm/parser_test.rb
rscm-0.2.1.1404 test/rscm/parser_test.rb
rscm-0.3.3 test/rscm/parser_test.rb
rscm-0.3.12 test/rscm/parser_test.rb
rscm-0.1.0 test/rscm/parser_test.rb
rscm-0.2.0 test/rscm/parser_test.rb
rscm-0.3.10 test/rscm/parser_test.rb
rscm-0.3.13 test/rscm/parser_test.rb
rscm-0.3.14 test/rscm/parser_test.rb
rscm-0.3.16 test/rscm/parser_test.rb
rscm-0.3.9 test/rscm/parser_test.rb