1# -*- coding: utf-8 -*-
2"""
3    Tests for QBasic
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.basic import QBasicLexer
14
15
16@pytest.fixture(scope='module')
17def lexer():
18    yield QBasicLexer()
19
20
21def test_keywords_with_dollar(lexer):
22    fragment = 'DIM x\nx = RIGHT$("abc", 1)\n'
23    expected = [
24        (Token.Keyword.Declaration, 'DIM'),
25        (Token.Text.Whitespace, ' '),
26        (Token.Name.Variable.Global, 'x'),
27        (Token.Text, '\n'),
28        (Token.Name.Variable.Global, 'x'),
29        (Token.Text.Whitespace, ' '),
30        (Token.Operator, '='),
31        (Token.Text.Whitespace, ' '),
32        (Token.Keyword.Reserved, 'RIGHT$'),
33        (Token.Punctuation, '('),
34        (Token.Literal.String.Double, '"abc"'),
35        (Token.Punctuation, ','),
36        (Token.Text.Whitespace, ' '),
37        (Token.Literal.Number.Integer.Long, '1'),
38        (Token.Punctuation, ')'),
39        (Token.Text, '\n'),
40    ]
41    assert list(lexer.get_tokens(fragment)) == expected
42