Sha256: 62bf6e7a1262f84159de24cf88be7fad766daeaef6c787a912595769f942ebd6

Contents?: true

Size: 898 Bytes

Versions: 5

Compression:

Stored size: 898 Bytes

Contents

# -*- coding: utf-8 -*-
"""
    Basic CLexer Test
    ~~~~~~~~~~~~~~~~~

    :copyright: Copyright 2006-2011 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""

import unittest
import os

from pygments.token import Text, Number
from pygments.lexers import CLexer


class CLexerTest(unittest.TestCase):

    def setUp(self):
        self.lexer = CLexer()

    def testNumbers(self):
        code = '42 23.42 23. .42 023 0xdeadbeef 23e+42 42e-23'
        wanted = []
        for item in zip([Number.Integer, Number.Float, Number.Float,
                         Number.Float, Number.Oct, Number.Hex,
                         Number.Float, Number.Float], code.split()):
            wanted.append(item)
            wanted.append((Text, ' '))
        wanted = [(Text, '')] + wanted[:-1] + [(Text, '\n')]
        self.assertEqual(list(self.lexer.get_tokens(code)), wanted)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pygments.rb-0.2.4 vendor/pygments-main/tests/test_clexer.py
pygments.rb-0.2.3 vendor/pygments-main/tests/test_clexer.py
pygments.rb-0.2.2 vendor/pygments-main/tests/test_clexer.py
pygments.rb-0.2.1 vendor/pygments-main/tests/test_clexer.py
pygments.rb-0.2.0 vendor/pygments-main/tests/test_clexer.py