diff options
| author | Georg Brandl <georg@python.org> | 2016-01-16 12:30:22 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2016-01-16 12:30:22 +0100 |
| commit | 0f3af18cdf94f11055e05e28a47ff71ba1e3acb0 (patch) | |
| tree | 680452c25fcac67420c4865d5467f259a6cd0e98 /tests | |
| parent | 174e34b3cf0736e1bf8134adaed567a5c56d131f (diff) | |
| parent | 3b6d4dfe41110b048783c1557e427d8c0c26d945 (diff) | |
| download | pygments-0f3af18cdf94f11055e05e28a47ff71ba1e3acb0.tar.gz | |
Merged in jiyinyiyong/pygments-main (pull request #526)
Cirru update, on dollar in variables
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/examplefiles/inform6_example | 7 | ||||
| -rw-r--r-- | tests/test_html_formatter.py | 8 | ||||
| -rw-r--r-- | tests/test_java.py | 38 |
3 files changed, 49 insertions, 4 deletions
diff --git a/tests/examplefiles/inform6_example b/tests/examplefiles/inform6_example index 73cdd087..6fa1fe5b 100644 --- a/tests/examplefiles/inform6_example +++ b/tests/examplefiles/inform6_example @@ -8,8 +8,8 @@ Switches d2SDq; Constant Story "Informal Testing"; Constant Headline "^Not a game.^";!% This is a comment, not ICL. -Release 2; -Serial "140308"; +Release 3; +Serial "151213"; Version 5; Ifndef TARGET_ZCODE; @@ -174,7 +174,8 @@ Extend 'wave' replace * -> NewWave; Extend only 'feel' 'touch' replace * noun -> Feel; -[ TestSub a b o; +[ TestSub "a\ + " b o "@@98"; ! Not an escape sequence. string 25 low_string; print "Test what?> "; table->0 = 260; diff --git a/tests/test_html_formatter.py b/tests/test_html_formatter.py index a82aaaf7..567de51f 100644 --- a/tests/test_html_formatter.py +++ b/tests/test_html_formatter.py @@ -192,3 +192,11 @@ class HtmlFormatterTest(unittest.TestCase): fmt.format(tokensource, outfile) self.assertTrue('<a href="test_html_formatter.py#L-165">test_ctags</a>' in outfile.getvalue()) + + def test_filename(self): + optdict = dict(filename="test.py") + outfile = StringIO() + fmt = HtmlFormatter(**optdict) + fmt.format(tokensource, outfile) + html = outfile.getvalue() + self.assertTrue(re.search("<span class=\"filename\">test.py</span><pre>", html)) diff --git a/tests/test_java.py b/tests/test_java.py index 33a64e99..f4096647 100644 --- a/tests/test_java.py +++ b/tests/test_java.py @@ -9,7 +9,7 @@ import unittest -from pygments.token import Text, Name, Operator, Keyword +from pygments.token import Text, Name, Operator, Keyword, Number from pygments.lexers import JavaLexer @@ -40,3 +40,39 @@ class JavaTest(unittest.TestCase): ] self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) + def testNumericLiterals(self): + fragment = '0 5L 9__542_72l 0xbEEf 0X9_A 0_35 01 0b0___101_0' + fragment += ' 0. .7_17F 3e-1_3d 1f 6_01.9e+3 0x.1Fp3 0XEP8D\n' + tokens = [ + (Number.Integer, '0'), + (Text, ' '), + (Number.Integer, '5L'), + (Text, ' '), + (Number.Integer, '9__542_72l'), + (Text, ' '), + (Number.Hex, '0xbEEf'), + (Text, ' '), + (Number.Hex, '0X9_A'), + (Text, ' '), + (Number.Oct, '0_35'), + (Text, ' '), + (Number.Oct, '01'), + (Text, ' '), + (Number.Bin, '0b0___101_0'), + (Text, ' '), + (Number.Float, '0.'), + (Text, ' '), + (Number.Float, '.7_17F'), + (Text, ' '), + (Number.Float, '3e-1_3d'), + (Text, ' '), + (Number.Float, '1f'), + (Text, ' '), + (Number.Float, '6_01.9e+3'), + (Text, ' '), + (Number.Float, '0x.1Fp3'), + (Text, ' '), + (Number.Float, '0XEP8D'), + (Text, '\n') + ] + self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) |
