diff options
author | Tim Hatch <tim@timhatch.com> | 2014-10-06 21:19:28 -0700 |
---|---|---|
committer | Tim Hatch <tim@timhatch.com> | 2014-10-06 21:19:28 -0700 |
commit | 877a173f8a91b3626dd2681e549a50fa269d717f (patch) | |
tree | af5a43dec8e65a3b0cada2eed17c461b1b8ee49a /tests/test_shell.py | |
parent | 4ad22ff46ce05d7c665d9489c8122b45d5fae082 (diff) | |
download | pygments-877a173f8a91b3626dd2681e549a50fa269d717f.tar.gz |
BashLexer: Correctly handle $'' strings.
Diffstat (limited to 'tests/test_shell.py')
-rw-r--r-- | tests/test_shell.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/test_shell.py b/tests/test_shell.py index ffcf2a69..eb09e8d1 100644 --- a/tests/test_shell.py +++ b/tests/test_shell.py @@ -25,12 +25,12 @@ class BashTest(unittest.TestCase): (Token.Name.Builtin, u'echo'), (Token.Text, u' '), (Token.Literal.String.Double, u'"'), - (Token.Keyword, u'${'), + (Token.String.Interpol, u'${'), (Token.Name.Variable, u'a'), (Token.Punctuation, u'//['), (Token.Literal.String.Double, u'"b"'), (Token.Punctuation, u']/'), - (Token.Keyword, u'}'), + (Token.String.Interpol, u'}'), (Token.Literal.String.Double, u'"'), (Token.Text, u'\n'), ] @@ -41,12 +41,23 @@ class BashTest(unittest.TestCase): tokens = [ (Token.Name.Builtin, u'echo'), (Token.Text, u' '), - (Token.Keyword, u'${'), + (Token.String.Interpol, u'${'), (Token.Name.Variable, u'a'), (Token.Punctuation, u'//['), (Token.Literal.String.Escape, u'\\"'), (Token.Punctuation, u']/'), - (Token.Keyword, u'}'), + (Token.String.Interpol, u'}'), (Token.Text, u'\n'), ] self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) + + def testParsedSingle(self): + fragment = u"a=$'abc\\''\n" + tokens = [ + (Token.Name.Variable, u'a'), + (Token.Operator, u'='), + (Token.Literal.String.Single, u"$'abc\\''"), + (Token.Text, u'\n'), + ] + self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) + |