diff options
author | Tim Hatch <tim@timhatch.com> | 2015-10-14 18:31:55 -0700 |
---|---|---|
committer | Tim Hatch <tim@timhatch.com> | 2015-10-14 18:31:55 -0700 |
commit | 6d0b5ca281d57ec6b7bf8e3bc94c6ff78e82cb35 (patch) | |
tree | 02ed1d534e632ad8643136489bdf219532c19bfe /tests/test_irc_formatter.py | |
parent | 95aa8d6427cd90285810deeb538dce9cdce7cf9f (diff) | |
download | pygments-6d0b5ca281d57ec6b7bf8e3bc94c6ff78e82cb35.tar.gz |
Add basic test for irc formatter
Diffstat (limited to 'tests/test_irc_formatter.py')
-rw-r--r-- | tests/test_irc_formatter.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/test_irc_formatter.py b/tests/test_irc_formatter.py new file mode 100644 index 00000000..649e430d --- /dev/null +++ b/tests/test_irc_formatter.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +""" + Pygments HTML formatter tests + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from __future__ import print_function + +import io +import os +import re +import unittest +import tempfile +from os.path import join, dirname, isfile + +from pygments.util import StringIO +from pygments.lexers import PythonLexer +from pygments.formatters import IRCFormatter + +import support + +tokensource = list(PythonLexer().get_tokens("lambda x: 123")) + +class HtmlFormatterTest(unittest.TestCase): + def test_correct_output(self): + hfmt = IRCFormatter() + houtfile = StringIO() + hfmt.format(tokensource, houtfile) + + self.assertEqual(u'\x0302lambda\x03 x: \x0302123\x03\n', houtfile.getvalue()) + |