mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Skip pygments tests if pygmentize isn't available
This commit is contained in:
@@ -50,31 +50,33 @@ class TestLexer < Test::Unit::TestCase
|
||||
assert !Lexer['Ruby'].eql?(Lexer.new('Ruby'))
|
||||
end
|
||||
|
||||
def test_colorize
|
||||
assert_equal <<-HTML, Lexer['Text only'].colorize("Hello")
|
||||
if Lexer.has_pygments?
|
||||
def test_colorize
|
||||
assert_equal <<-HTML, Lexer['Text only'].colorize("Hello")
|
||||
<div class="highlight"><pre>Hello
|
||||
</pre>
|
||||
</div>
|
||||
HTML
|
||||
HTML
|
||||
|
||||
assert_equal <<-HTML, Lexer['Ruby'].colorize("def foo\n 'foo'\nend\n")
|
||||
assert_equal <<-HTML, Lexer['Ruby'].colorize("def foo\n 'foo'\nend\n")
|
||||
<div class="highlight"><pre><span class="k">def</span> <span class="nf">foo</span>
|
||||
<span class="s1">'foo'</span>
|
||||
<span class="k">end</span>
|
||||
</pre>
|
||||
</div>
|
||||
HTML
|
||||
end
|
||||
HTML
|
||||
end
|
||||
|
||||
def test_colorize_without_wrapper
|
||||
assert_equal <<-HTML, Lexer['Text only'].colorize_without_wrapper("Hello")
|
||||
def test_colorize_without_wrapper
|
||||
assert_equal <<-HTML, Lexer['Text only'].colorize_without_wrapper("Hello")
|
||||
Hello
|
||||
HTML
|
||||
HTML
|
||||
|
||||
assert_equal <<-HTML, Lexer['Ruby'].colorize_without_wrapper("def foo\n 'foo'\nend\n")
|
||||
assert_equal <<-HTML, Lexer['Ruby'].colorize_without_wrapper("def foo\n 'foo'\nend\n")
|
||||
<span class="k">def</span> <span class="nf">foo</span>
|
||||
<span class="s1">'foo'</span>
|
||||
<span class="k">end</span>
|
||||
HTML
|
||||
HTML
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user