mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Replace Lexer with Pygments::Lexer
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
require 'linguist/language'
|
||||
|
||||
require 'test/unit'
|
||||
require 'pygments'
|
||||
|
||||
class TestLanguage < Test::Unit::TestCase
|
||||
include Linguist
|
||||
|
||||
Lexer = Pygments::Lexer
|
||||
|
||||
def test_ambiguous_extensions
|
||||
assert Language.ambiguous?('.h')
|
||||
assert_equal Language['C'], Language.find_by_extension('h')
|
||||
@@ -311,26 +314,4 @@ class TestLanguage < Test::Unit::TestCase
|
||||
</div>
|
||||
HTML
|
||||
end
|
||||
|
||||
def test_colorize_without_wrapper
|
||||
assert_equal <<-HTML, Language['Text'].colorize_without_wrapper("Hello")
|
||||
Hello
|
||||
HTML
|
||||
|
||||
assert_equal <<-HTML, Language['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
|
||||
end
|
||||
|
||||
def test_colorize_doesnt_strip_newlines
|
||||
assert_equal <<-HTML, Language['Ruby'].colorize_without_wrapper("\n\n# Foo\ndef 'foo'\nend\n")
|
||||
|
||||
|
||||
<span class="c1"># Foo</span>
|
||||
<span class="k">def</span> <span class="s1">'foo'</span>
|
||||
<span class="k">end</span>
|
||||
HTML
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user