2011-03-05 12:46:40 +00:00
|
|
|
require File.expand_path('../helper', __FILE__)
|
2010-11-22 13:38:01 +00:00
|
|
|
|
|
|
|
class RoccoCommentNormalization < Test::Unit::TestCase
|
2011-03-05 11:48:15 +00:00
|
|
|
def test_normal_comments
|
|
|
|
r = Rocco.new( 'test', '', { :language => "python" } ) { "" } # Generate throwaway instance so I can test `parse`
|
|
|
|
assert_equal(
|
|
|
|
[
|
|
|
|
[ [ "Comment 1a", "Comment 1b" ], [ "def codeblock", "end" ] ],
|
|
|
|
[ [ "Comment 2a", " Comment 2b" ], [] ]
|
|
|
|
],
|
|
|
|
r.parse( "\"\"\"\n Comment 1a\n Comment 1b\n\"\"\"\ndef codeblock\nend\n\"\"\"\n Comment 2a\n Comment 2b\n\"\"\"\n" )
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_single_line_comments
|
|
|
|
r = Rocco.new( 'test', '', { :language => "python" } ) { "" } # Generate throwaway instance so I can test `parse`
|
|
|
|
assert_equal(
|
|
|
|
[
|
|
|
|
[ [ "Comment 1a", "Comment 1b" ], [ "def codeblock", "end" ] ],
|
|
|
|
[ [ "Comment 2a", " Comment 2b" ], [] ]
|
|
|
|
],
|
|
|
|
r.parse( "# Comment 1a\n# Comment 1b\ndef codeblock\nend\n# Comment 2a\n# Comment 2b\n" )
|
|
|
|
)
|
|
|
|
end
|
2010-11-22 13:38:01 +00:00
|
|
|
end
|