two char indent and whitespace error fixes
This commit is contained in:
parent
a2d316b20d
commit
f40e57baae
@ -1,6 +1,4 @@
|
||||
require 'test/unit'
|
||||
|
||||
tests = Dir["#{File.dirname(__FILE__)}/test_*.rb"]
|
||||
tests.each do |file|
|
||||
require file
|
||||
end
|
||||
Dir["#{File.dirname(__FILE__)}/test_*.rb"].
|
||||
each { |file| require file }
|
||||
|
@ -60,5 +60,4 @@ class RoccoBasicTests < Test::Unit::TestCase
|
||||
] )
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -16,6 +16,7 @@ class RoccoBlockCommentTest < Test::Unit::TestCase
|
||||
r.parse( "/**\n * Comment 1a\n * Comment 1b\n */\ndef codeblock\nend\n" )
|
||||
)
|
||||
end
|
||||
|
||||
def test_multiple_blocks
|
||||
r = Rocco.new( 'test', '', { :language => "c" } ) { "" } # Generate throwaway instance so I can test `parse`
|
||||
assert_equal(
|
||||
@ -33,6 +34,7 @@ class RoccoBlockCommentTest < Test::Unit::TestCase
|
||||
r.parse( "/**\n * Comment 1\n */\ndef codeblock\nend\n/**\n * Comment 2\n */\nif false\nend" )
|
||||
)
|
||||
end
|
||||
|
||||
def test_block_without_middle_character
|
||||
r = Rocco.new( 'test', '', { :language => "python" } ) { "" } # Generate throwaway instance so I can test `parse`
|
||||
assert_equal(
|
||||
@ -50,6 +52,7 @@ class RoccoBlockCommentTest < Test::Unit::TestCase
|
||||
r.parse( "\"\"\"\n Comment 1\n\"\"\"\ndef codeblock\nend\n\"\"\"\n Comment 2\n\"\"\"\nif false\nend" )
|
||||
)
|
||||
end
|
||||
|
||||
def test_language_without_single_line_comments_parse
|
||||
r = Rocco.new( 'test', '', { :language => "css" } ) { "" } # Generate throwaway instance so I can test `parse`
|
||||
assert_equal(
|
||||
@ -60,6 +63,7 @@ class RoccoBlockCommentTest < Test::Unit::TestCase
|
||||
r.parse( "/**\n * Comment 1\n */\ndef codeblock\nend\n/**\n * Comment 2\n */\nif false\nend" )
|
||||
)
|
||||
end
|
||||
|
||||
def test_language_without_single_line_comments_split
|
||||
r = Rocco.new( 'test', '', { :language => "css" } ) { "" } # Generate throwaway instance so I can test `parse`
|
||||
assert_equal(
|
||||
@ -73,6 +77,7 @@ class RoccoBlockCommentTest < Test::Unit::TestCase
|
||||
] )
|
||||
)
|
||||
end
|
||||
|
||||
def test_language_without_single_line_comments_highlight
|
||||
r = Rocco.new( 'test', '', { :language => "css" } ) { "" } # Generate throwaway instance so I can test `parse`
|
||||
|
||||
@ -80,19 +85,17 @@ class RoccoBlockCommentTest < Test::Unit::TestCase
|
||||
assert_equal(
|
||||
"<p>This is a comment!</p>",
|
||||
highlighted[0][0]
|
||||
);
|
||||
)
|
||||
assert_equal(
|
||||
"<p>Comment 2</p>\n",
|
||||
highlighted[1][0]
|
||||
);
|
||||
)
|
||||
assert(
|
||||
!highlighted[0][1].include?("DIVIDER") &&
|
||||
!highlighted[1][1].include?("DIVIDER"),
|
||||
"`DIVIDER` stripped successfully."
|
||||
)
|
||||
|
||||
assert( true
|
||||
);
|
||||
assert( true )
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -11,6 +11,7 @@ class RoccoCommentNormalization < Test::Unit::TestCase
|
||||
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(
|
||||
|
@ -5,18 +5,22 @@ class RoccoAutomaticCommentChars < Test::Unit::TestCase
|
||||
r = Rocco.new( 'filename.js' ) { "" }
|
||||
assert_equal "//", r.options[:comment_chars][:single]
|
||||
end
|
||||
|
||||
def test_fallback_language
|
||||
r = Rocco.new( 'filename.an_extension_with_no_meaning_whatsoever', '', { :language => "js" } ) { "" }
|
||||
assert_equal "//", r.options[:comment_chars][:single]
|
||||
end
|
||||
|
||||
def test_fallback_default
|
||||
r = Rocco.new( 'filename.an_extension_with_no_meaning_whatsoever' ) { "" }
|
||||
assert_equal "#", r.options[:comment_chars][:single], "`:comment_chars` should be `#` when falling back to defaults."
|
||||
end
|
||||
|
||||
def test_fallback_user
|
||||
r = Rocco.new( 'filename.an_extension_with_no_meaning_whatsoever', '', { :comment_chars => "user" } ) { "" }
|
||||
assert_equal "user", r.options[:comment_chars][:single], "`:comment_chars` should be the user's default when falling back to user-provided settings."
|
||||
end
|
||||
|
||||
def test_fallback_user_with_unknown_language
|
||||
r = Rocco.new( 'filename.an_extension_with_no_meaning_whatsoever', '', { :language => "not-a-language", :comment_chars => "user" } ) { "" }
|
||||
assert_equal "user", r.options[:comment_chars][:single], "`:comment_chars` should be the user's default when falling back to user-provided settings."
|
||||
|
@ -13,6 +13,7 @@ class RoccoDescriptiveSectionNamesTests < Test::Unit::TestCase
|
||||
"The rendered HTML should link to a named section"
|
||||
)
|
||||
end
|
||||
|
||||
def test_section_numbering
|
||||
r = roccoize( "filename.rb", "# # Header 1\ndef codeblock\nend\n# Comment 1\ndef codeblock1\nend\n# # Header 2\ndef codeblock2\nend" )
|
||||
html = r.to_html
|
||||
|
@ -8,6 +8,7 @@ class RoccoLanguageDetection < Test::Unit::TestCase
|
||||
assert_equal "python", r.options[:language], "`@options[:language]` should be set to the correct language"
|
||||
end
|
||||
end
|
||||
|
||||
def test_fallback_default
|
||||
r = Rocco.new( 'filename.an_extension_with_no_meaning_whatsoever' ) { "" }
|
||||
if r.pygmentize?
|
||||
@ -15,6 +16,7 @@ class RoccoLanguageDetection < Test::Unit::TestCase
|
||||
assert_equal "ruby", r.options[:language], "`@options[:language]` should be set to `ruby` when nothing else is detected"
|
||||
end
|
||||
end
|
||||
|
||||
def test_fallback_user
|
||||
r = Rocco.new( 'filename.an_extension_with_no_meaning_whatsoever', '', { :language => "c" } ) { "" }
|
||||
if r.pygmentize?
|
||||
|
@ -12,6 +12,7 @@ class RoccoSkippableLines < Test::Unit::TestCase
|
||||
"Shebang should be stripped when it appears as the first line."
|
||||
)
|
||||
end
|
||||
|
||||
def test_shebang_in_content
|
||||
r = Rocco.new( 'filename.sh' ) { "" }
|
||||
assert_equal(
|
||||
@ -24,6 +25,7 @@ class RoccoSkippableLines < Test::Unit::TestCase
|
||||
"Shebang shouldn't be stripped anywhere other than as the first line."
|
||||
)
|
||||
end
|
||||
|
||||
def test_encoding_in_ruby
|
||||
r = Rocco.new( 'filename.rb' ) { "" }
|
||||
assert_equal(
|
||||
@ -35,6 +37,7 @@ class RoccoSkippableLines < Test::Unit::TestCase
|
||||
"Strings matching the PEP 263 encoding definition regex should be stripped when they appear at the top of a python document."
|
||||
)
|
||||
end
|
||||
|
||||
def test_encoding_in_python
|
||||
r = Rocco.new( 'filename.py' ) { "" }
|
||||
assert_equal(
|
||||
@ -46,6 +49,7 @@ class RoccoSkippableLines < Test::Unit::TestCase
|
||||
"Strings matching the PEP 263 encoding definition regex should be stripped when they appear at the top of a python document."
|
||||
)
|
||||
end
|
||||
|
||||
def test_encoding_in_notpython
|
||||
r = Rocco.new( 'filename.sh' ) { "" }
|
||||
assert_equal(
|
||||
|
@ -13,6 +13,7 @@ class RoccoSourceListTests < Test::Unit::TestCase
|
||||
"URLs correctly generated for files in a flat directory structure"
|
||||
)
|
||||
end
|
||||
|
||||
def test_heiarachical_sourcelist
|
||||
r = Rocco.new( 'a/issue26.sh', [ 'a/issue26a.sh', 'b/issue26b.sh', 'c/issue26c.sh' ] ) {
|
||||
"# Comment 1\n# Comment 1\nprint 'omg!'"
|
||||
@ -25,5 +26,4 @@ class RoccoSourceListTests < Test::Unit::TestCase
|
||||
"URLs correctly generated for files in a flat directory structure"
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user