Show More
@@ -5,6 +5,7 b'' | |||||
5 |
|
5 | |||
6 | from unittest import TestCase |
|
6 | from unittest import TestCase | |
7 | from pygments.token import Token |
|
7 | from pygments.token import Token | |
|
8 | from pygments.lexers import BashLexer | |||
8 |
|
9 | |||
9 | from .. import lexers |
|
10 | from .. import lexers | |
10 |
|
11 | |||
@@ -13,16 +14,14 b' class TestLexers(TestCase):' | |||||
13 | """Collection of lexers tests""" |
|
14 | """Collection of lexers tests""" | |
14 | def setUp(self): |
|
15 | def setUp(self): | |
15 | self.lexer = lexers.IPythonLexer() |
|
16 | self.lexer = lexers.IPythonLexer() | |
|
17 | self.bash_lexer = BashLexer() | |||
16 |
|
18 | |||
17 | def testIPythonLexer(self): |
|
19 | def testIPythonLexer(self): | |
18 | fragment = '!echo $HOME\n' |
|
20 | fragment = '!echo $HOME\n' | |
19 | tokens = [ |
|
21 | tokens = [ | |
20 | (Token.Operator, '!'), |
|
22 | (Token.Operator, '!'), | |
21 | (Token.Name.Builtin, 'echo'), |
|
|||
22 | (Token.Text, ' '), |
|
|||
23 | (Token.Name.Variable, '$HOME'), |
|
|||
24 | (Token.Text, '\n'), |
|
|||
25 | ] |
|
23 | ] | |
|
24 | tokens.extend(self.bash_lexer.get_tokens(fragment[1:])) | |||
26 | self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) |
|
25 | self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) | |
27 |
|
26 | |||
28 | fragment_2 = '!' + fragment |
|
27 | fragment_2 = '!' + fragment |
General Comments 0
You need to be logged in to leave comments.
Login now