Sha256: bf49b71b41797aba69f91a8d964f199072ce2859b04c27e94bfed88e382dc81a

Contents?: true

Size: 1.42 KB

Versions: 9

Compression:

Stored size: 1.42 KB

Contents

require 'stringio'
require 'tempfile'
require 'rubygems'
require 'minitest/unit'
require 'rdoc/options'
require 'rdoc/parser/perl'

class TestRdocParserPerlPOD < MiniTest::Unit::TestCase

  def setup
    @tempfile = Tempfile.new self.class.name
    filename = @tempfile.path

    @top_level = RDoc::TopLevel.new filename
    @fn = filename
    @options = RDoc::Options.new
    @stats = RDoc::Stats.new 0
  end

  def teardown
    @tempfile.close
  end

  def test_uncommented_perl
    content = <<-EOF
while (<>) {
  tr/a-z/A-Z;
  print
}
    EOF

    comment =  util_get_comment content
    assert_equal "", comment
  end

  def test_perl_without_pod
    content = <<-EOF
#!/usr/local/bin/perl
#
#This is a pointless perl program because it does -p.
#
while(<>) {print;}:
    EOF

    comment = util_get_comment content
    assert_equal "", comment
  end

  def test_simple_pod_no_structure
    content = <<-EOF
=begin pod

This just contains plain old documentation

=end
    EOF
    comment = util_get_comment content
    assert_equal "\nThis just contains plain old documentation\n\n", comment
  end

  # Get the comment of the @top_level when it has processed the input.
  def util_get_comment(content)
    parser = util_parser content
    parser.scan.comment
  end

  # create a new parser with the supplied content.
  def util_parser(content)
    RDoc::Parser::PerlPOD.new @top_level, @fn, content, @options, @stats
  end

end

MiniTest::Unit.autorun

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
middleman-0.10.17 vendor/gems/gems/rdoc-2.4.3/test/test_rdoc_parser_perl.rb
middleman-0.10.16 vendor/gems/gems/rdoc-2.4.3/test/test_rdoc_parser_perl.rb
middleman-0.10.15 vendor/gems/gems/rdoc-2.4.3/test/test_rdoc_parser_perl.rb
middleman-0.10.14 vendor/gems/gems/rdoc-2.4.3/test/test_rdoc_parser_perl.rb
rdoc-2.4.0 test/test_rdoc_parser_perl.rb
rdoc-2.4.3 test/test_rdoc_parser_perl.rb
rdoc-2.3.0 test/test_rdoc_parser_perl.rb
rdoc-2.4.1 test/test_rdoc_parser_perl.rb
rdoc-2.4.2 test/test_rdoc_parser_perl.rb