Switch to Pygments.rb

This commit is contained in:
Joshua Peek
2011-08-22 10:55:39 -05:00
parent e70ffb93ba
commit bb11317546
5 changed files with 36 additions and 52 deletions

View File

@@ -61,33 +61,31 @@ class TestLexer < Test::Unit::TestCase
assert !Lexer['Ruby'].eql?(Lexer.new('Ruby'))
end
if Lexer.has_pygments?
def test_colorize
assert_equal <<-HTML, Lexer['Text only'].colorize("Hello")
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">&#39;foo&#39;</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">&#39;foo&#39;</span>
<span class="k">end</span>
HTML
end
HTML
end
end