From d352bbdf4d2f6265d4ee934799775b044eb47678 Mon Sep 17 00:00:00 2001 From: Tim Hatch Date: Tue, 31 May 2016 21:46:37 -0700 Subject: Allow open c-style comments. Fixes #1114 --- tests/test_cpp.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/test_cpp.py (limited to 'tests/test_cpp.py') diff --git a/tests/test_cpp.py b/tests/test_cpp.py new file mode 100644 index 00000000..e1b94a8e --- /dev/null +++ b/tests/test_cpp.py @@ -0,0 +1,32 @@ +""" + CPP Tests + ~~~~~~~~~ + + :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import unittest + +from pygments.lexers import CppLexer +from pygments.token import Token + + +class CppTest(unittest.TestCase): + def setUp(self): + self.lexer = CppLexer() + + def testGoodComment(self): + fragment = u'/* foo */\n' + tokens = [ + (Token.Comment.Multiline, u'/* foo */'), + (Token.Text, u'\n'), + ] + self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) + + def testOpenComment(self): + fragment = u'/* foo\n' + tokens = [ + (Token.Comment.Multiline, u'/* foo\n'), + ] + self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) -- cgit v1.2.1