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