diff options
author | Tim Hatch <tim@timhatch.com> | 2014-10-06 21:55:49 -0700 |
---|---|---|
committer | Tim Hatch <tim@timhatch.com> | 2014-10-06 21:55:49 -0700 |
commit | 55cfc317915837ef74f6779be15a478563b4c772 (patch) | |
tree | c6a2a4dd83450e37d05c4bd560f8cb920e0d36ba /tests/test_ruby.py | |
parent | 855647a8912f4b82209b45d028a69334c37b75d5 (diff) | |
download | pygments-55cfc317915837ef74f6779be15a478563b4c772.tar.gz |
RubyLexer: Be less picky about closing delimiters.
Previous code used a negative lookbehind, which I do not grok how was ever
correct. New code with testcase.
Fixes #1026
Diffstat (limited to 'tests/test_ruby.py')
-rw-r--r-- | tests/test_ruby.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_ruby.py b/tests/test_ruby.py index 9c6bc085..89991f74 100644 --- a/tests/test_ruby.py +++ b/tests/test_ruby.py @@ -123,3 +123,23 @@ class RubyTest(unittest.TestCase): ] self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) + def testEscapedBracestring(self): + fragment = u'str.gsub(%r{\\\\\\\\}, "/")\n' + tokens = [ + (Token.Name, u'str'), + (Token.Operator, u'.'), + (Token.Name, u'gsub'), + (Token.Punctuation, u'('), + (Token.Literal.String.Regex, u'%r{'), + (Token.Literal.String.Regex, u'\\\\'), + (Token.Literal.String.Regex, u'\\\\'), + (Token.Literal.String.Regex, u'}'), + (Token.Punctuation, u','), + (Token.Text, u' '), + (Token.Literal.String.Double, u'"'), + (Token.Literal.String.Double, u'/'), + (Token.Literal.String.Double, u'"'), + (Token.Punctuation, u')'), + (Token.Text, u'\n'), + ] + self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) |