Show More
@@ -49,9 +49,9 b' from IPython.testing.skipdoctest import skip_doctest' | |||
|
49 | 49 | line_re = re.compile('.*?\n') |
|
50 | 50 | |
|
51 | 51 | ipython_tokens = [ |
|
52 |
(r'( |
|
|
52 | (r'(%)(sx|sc|system)(.*)(\n)', bygroups(Operator, Keyword, | |
|
53 | 53 | using(BashLexer), Text)), |
|
54 |
(r'(\ |
|
|
54 | (r'(%)(\w+)(.*\n)', bygroups(Operator, Keyword, Text)), | |
|
55 | 55 | (r'^(!)(.+)(\n)', bygroups(Operator, using(BashLexer), Text)), |
|
56 | 56 | (r'^(.+)(=)(\s*)(!)(.+)(\n)', bygroups( |
|
57 | 57 | # With the limited syntax allowed on the l.h.s. of a shell capture, |
@@ -42,6 +42,7 b' class TestLexers(TestsBase):' | |||
|
42 | 42 | (Token.Text, ' '), |
|
43 | 43 | ] + tokens |
|
44 | 44 | self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) |
|
45 | ||
|
45 | 46 | fragment_2 = 'x, = ' + fragment |
|
46 | 47 | tokens_2 = [ |
|
47 | 48 | (Token.Name, 'x'), |
@@ -51,3 +52,28 b' class TestLexers(TestsBase):' | |||
|
51 | 52 | (Token.Text, ' '), |
|
52 | 53 | ] + tokens |
|
53 | 54 | self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) |
|
55 | ||
|
56 | fragment_2 = 'x, = %sx ' + fragment[1:] | |
|
57 | tokens_2 = [ | |
|
58 | (Token.Name, 'x'), | |
|
59 | (Token.Punctuation, ','), | |
|
60 | (Token.Text, ' '), | |
|
61 | (Token.Operator, '='), | |
|
62 | (Token.Text, ' '), | |
|
63 | (Token.Operator, '%'), | |
|
64 | (Token.Keyword, 'sx'), | |
|
65 | (Token.Text, ' '), | |
|
66 | ] + tokens[1:] | |
|
67 | self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) | |
|
68 | ||
|
69 | fragment_2 = 'f = %R function () {}\n' | |
|
70 | tokens_2 = [ | |
|
71 | (Token.Name, 'f'), | |
|
72 | (Token.Text, ' '), | |
|
73 | (Token.Operator, '='), | |
|
74 | (Token.Text, ' '), | |
|
75 | (Token.Operator, '%'), | |
|
76 | (Token.Keyword, 'R'), | |
|
77 | (Token.Text, ' function () {}\n'), | |
|
78 | ] | |
|
79 | self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2))) |
General Comments 0
You need to be logged in to leave comments.
Login now