1# -*- coding: utf-8 -*-
2"""
3    Basic SmartyLexer Test
4    ~~~~~~~~~~~~~~~~~~~~~~
5
6    :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS.
7    :license: BSD, see LICENSE for details.
8"""
9
10import pytest
11
12from pygments.token import Token
13from pygments.lexers import SmartyLexer
14
15
16@pytest.fixture(scope='module')
17def lexer():
18    yield SmartyLexer()
19
20
21def test_nested_curly(lexer):
22    fragment = '{templateFunction param={anotherFunction} param2=$something}\n'
23    tokens = [
24        (Token.Comment.Preproc, '{'),
25        (Token.Name.Function, 'templateFunction'),
26        (Token.Text, ' '),
27        (Token.Name.Attribute, 'param'),
28        (Token.Operator, '='),
29        (Token.Comment.Preproc, '{'),
30        (Token.Name.Attribute, 'anotherFunction'),
31        (Token.Comment.Preproc, '}'),
32        (Token.Text, ' '),
33        (Token.Name.Attribute, 'param2'),
34        (Token.Operator, '='),
35        (Token.Name.Variable, '$something'),
36        (Token.Comment.Preproc, '}'),
37        (Token.Other, '\n'),
38    ]
39    assert list(lexer.get_tokens(fragment)) == tokens
40