diff options
author | Georg Brandl <georg@python.org> | 2014-10-08 09:21:15 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-10-08 09:21:15 +0200 |
commit | 444fb6fd9b3492040a36fcca672fee8175f8d603 (patch) | |
tree | 2bd411ca78decf276b95dc6b1788e594b2e35287 /tests/test_smarty.py | |
parent | 491fec23ef01687906f5d71ee718522cd2917926 (diff) | |
parent | c1bfe4eed3805d3556bffa3c6b9cc2d3f6976205 (diff) | |
download | pygments-444fb6fd9b3492040a36fcca672fee8175f8d603.tar.gz |
Merged in leodemoura/pygments-main (pull request #399)
Diffstat (limited to 'tests/test_smarty.py')
-rw-r--r-- | tests/test_smarty.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/test_smarty.py b/tests/test_smarty.py new file mode 100644 index 00000000..20346afd --- /dev/null +++ b/tests/test_smarty.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +""" + Basic SmartyLexer Test + ~~~~~~~~~~~~~~~~~~~~ + + :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import unittest + +from pygments.token import Operator, Number, Text, Token +from pygments.lexers import SmartyLexer + + +class SmartyTest(unittest.TestCase): + + def setUp(self): + self.lexer = SmartyLexer() + + def testNestedCurly(self): + fragment = u'{templateFunction param={anotherFunction} param2=$something}\n' + tokens = [ + (Token.Comment.Preproc, u'{'), + (Token.Name.Function, u'templateFunction'), + (Token.Text, u' '), + (Token.Name.Attribute, u'param'), + (Token.Operator, u'='), + (Token.Comment.Preproc, u'{'), + (Token.Name.Attribute, u'anotherFunction'), + (Token.Comment.Preproc, u'}'), + (Token.Text, u' '), + (Token.Name.Attribute, u'param2'), + (Token.Operator, u'='), + (Token.Name.Variable, u'$something'), + (Token.Comment.Preproc, u'}'), + (Token.Other, u'\n'), + ] + self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) + |