diff options
Diffstat (limited to 'tests')
39 files changed, 101 insertions, 43 deletions
diff --git a/tests/examplefiles/demo.hbs b/tests/examplefiles/demo.hbs index 1b9ed5a7..ae80cc1b 100644 --- a/tests/examplefiles/demo.hbs +++ b/tests/examplefiles/demo.hbs @@ -10,3 +10,25 @@ {{else}} <button {{action expand}}>Show More...</button> {{/if}} + +{{> myPartial}} +{{> myPartial var="value" }} +{{> myPartial var=../value}} +{{> (myPartial)}} +{{> (myPartial) var="value"}} +{{> (lookup . "myPartial")}} +{{> ( lookup . "myPartial" ) var="value" }} +{{> (lookup ../foo "myPartial") var="value" }} +{{> @partial-block}} + +{{#>myPartial}} +... +{{/myPartial}} + +{{#*inline "myPartial"}} +... +{{/inline}} + +{{../name}} +{{./name}} +{{this/name}} diff --git a/tests/examplefiles/example.hs b/tests/examplefiles/example.hs index f5e2b555..764cab77 100644 --- a/tests/examplefiles/example.hs +++ b/tests/examplefiles/example.hs @@ -29,3 +29,13 @@ data ĈrazyThings = -- some char literals: charl = ['"', 'a', '\ESC', '\'', ' '] + +-- closed type families +type family Fam (a :: Type) = r :: Type where + Fam Int = True + Fam a = False + +-- type literals +type IntChar = '[Int, Char] +type Falsy = 'False +type Falsy = '(10, 20, 30) diff --git a/tests/run.py b/tests/run.py index 8167b911..07665b2a 100644 --- a/tests/run.py +++ b/tests/run.py @@ -8,7 +8,7 @@ python run.py [testfile ...] - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/string_asserts.py b/tests/string_asserts.py index 11f5c7f0..05e95e6a 100644 --- a/tests/string_asserts.py +++ b/tests/string_asserts.py @@ -3,7 +3,7 @@ Pygments string assert utility ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_basic_api.py b/tests/test_basic_api.py index 022e6c55..ac3b4a51 100644 --- a/tests/test_basic_api.py +++ b/tests/test_basic_api.py @@ -3,7 +3,7 @@ Pygments basic API tests ~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -161,8 +161,8 @@ def test_formatter_public_api(): try: inst = formatter(opt1="val1") - except (ImportError, FontNotFound): - raise support.SkipTest + except (ImportError, FontNotFound) as e: + raise support.SkipTest(e) try: inst.get_style_defs() @@ -209,9 +209,9 @@ def test_formatter_unicode_handling(): def verify(formatter): try: inst = formatter(encoding=None) - except (ImportError, FontNotFound): + except (ImportError, FontNotFound) as e: # some dependency or font not installed - raise support.SkipTest + raise support.SkipTest(e) if formatter.name != 'Raw tokens': out = format(tokens, inst) diff --git a/tests/test_bibtex.py b/tests/test_bibtex.py index d007766d..5ad92db4 100644 --- a/tests/test_bibtex.py +++ b/tests/test_bibtex.py @@ -3,7 +3,7 @@ BibTeX Test ~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_cfm.py b/tests/test_cfm.py index 2585489a..0ff1b167 100644 --- a/tests/test_cfm.py +++ b/tests/test_cfm.py @@ -3,7 +3,7 @@ Basic ColdfusionHtmlLexer Test ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_clexer.py b/tests/test_clexer.py index fd7f58fc..5095b797 100644 --- a/tests/test_clexer.py +++ b/tests/test_clexer.py @@ -3,7 +3,7 @@ Basic CLexer Test ~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index 5883fb5c..a37fb498 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -3,7 +3,7 @@ Command line test ~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_examplefiles.py b/tests/test_examplefiles.py index f43abf9b..2fae1125 100644 --- a/tests/test_examplefiles.py +++ b/tests/test_examplefiles.py @@ -3,7 +3,7 @@ Pygments tests with example files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -89,7 +89,7 @@ def test_example_files(): def check_lexer(lx, fn): if os.name == 'java' and fn in BAD_FILES_FOR_JYTHON: - raise support.SkipTest + raise support.SkipTest('%s is a known bad file on Jython' % fn) absfn = os.path.join(TESTDIR, 'examplefiles', fn) with open(absfn, 'rb') as fp: text = fp.read() diff --git a/tests/test_html_formatter.py b/tests/test_html_formatter.py index 596d9fbc..79990edd 100644 --- a/tests/test_html_formatter.py +++ b/tests/test_html_formatter.py @@ -3,7 +3,7 @@ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_inherit.py b/tests/test_inherit.py index 34033a08..5da57dd9 100644 --- a/tests/test_inherit.py +++ b/tests/test_inherit.py @@ -3,7 +3,7 @@ Tests for inheritance in RegexLexer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_irc_formatter.py b/tests/test_irc_formatter.py index 16a8fd30..3b34f0bc 100644 --- a/tests/test_irc_formatter.py +++ b/tests/test_irc_formatter.py @@ -3,7 +3,7 @@ Pygments IRC formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_java.py b/tests/test_java.py index f4096647..6e5e8992 100644 --- a/tests/test_java.py +++ b/tests/test_java.py @@ -3,7 +3,7 @@ Basic JavaLexer Test ~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_javascript.py b/tests/test_javascript.py index 59890659..21dff7c4 100644 --- a/tests/test_javascript.py +++ b/tests/test_javascript.py @@ -3,7 +3,7 @@ Javascript tests ~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_julia.py b/tests/test_julia.py index 08c420d3..ed46f27e 100644 --- a/tests/test_julia.py +++ b/tests/test_julia.py @@ -3,7 +3,7 @@ Julia Tests ~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_latex_formatter.py b/tests/test_latex_formatter.py index 05a6c3ac..ebed7964 100644 --- a/tests/test_latex_formatter.py +++ b/tests/test_latex_formatter.py @@ -3,7 +3,7 @@ Pygments LaTeX formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -42,9 +42,9 @@ class LatexFormatterTest(unittest.TestCase): ret = po.wait() output = po.stdout.read() po.stdout.close() - except OSError: + except OSError as e: # latex not available - raise support.SkipTest + raise support.SkipTest(e) else: if ret: print(output) diff --git a/tests/test_lexers_other.py b/tests/test_lexers_other.py index 90d05ef8..3716fb72 100644 --- a/tests/test_lexers_other.py +++ b/tests/test_lexers_other.py @@ -3,7 +3,7 @@ Tests for other lexers ~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import glob diff --git a/tests/test_modeline.py b/tests/test_modeline.py new file mode 100644 index 00000000..efe038df --- /dev/null +++ b/tests/test_modeline.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +""" + Tests for the vim modeline feature + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from __future__ import print_function + +from pygments import modeline + + +def test_lexer_classes(): + def verify(buf): + assert modeline.get_filetype_from_buffer(buf) == 'python' + + for buf in [ + 'vi: ft=python' + '\n' * 8, + 'vi: ft=python' + '\n' * 8, + '\n\n\n\nvi=8: syntax=python' + '\n' * 8, + '\n' * 8 + 'ex: filetype=python', + '\n' * 8 + 'vim: some,other,syn=python\n\n\n\n' + ]: + yield verify, buf diff --git a/tests/test_objectiveclexer.py b/tests/test_objectiveclexer.py index 90bd680f..aee7db66 100644 --- a/tests/test_objectiveclexer.py +++ b/tests/test_objectiveclexer.py @@ -3,7 +3,7 @@ Basic CLexer Test ~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_perllexer.py b/tests/test_perllexer.py index 26b2d0a7..2fcaae7e 100644 --- a/tests/test_perllexer.py +++ b/tests/test_perllexer.py @@ -3,7 +3,7 @@ Pygments regex lexer tests ~~~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_php.py b/tests/test_php.py index 050ca70d..b4117381 100644 --- a/tests/test_php.py +++ b/tests/test_php.py @@ -3,7 +3,7 @@ PHP Tests ~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_praat.py b/tests/test_praat.py index 471d5e2c..1ca97d1e 100644 --- a/tests/test_praat.py +++ b/tests/test_praat.py @@ -3,7 +3,7 @@ Praat lexer tests ~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_properties.py b/tests/test_properties.py index 333f3d7a..562778ba 100644 --- a/tests/test_properties.py +++ b/tests/test_properties.py @@ -3,7 +3,7 @@ Properties Tests ~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_python.py b/tests/test_python.py index f5784cb1..e99687a6 100644 --- a/tests/test_python.py +++ b/tests/test_python.py @@ -3,7 +3,7 @@ Python Tests ~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_qbasiclexer.py b/tests/test_qbasiclexer.py index 8b790cee..0ea221a1 100644 --- a/tests/test_qbasiclexer.py +++ b/tests/test_qbasiclexer.py @@ -3,7 +3,7 @@ Tests for QBasic ~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_regexlexer.py b/tests/test_regexlexer.py index eb25be61..d919a950 100644 --- a/tests/test_regexlexer.py +++ b/tests/test_regexlexer.py @@ -3,7 +3,7 @@ Pygments regex lexer tests ~~~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_regexopt.py b/tests/test_regexopt.py index 6322c735..5cfb62a3 100644 --- a/tests/test_regexopt.py +++ b/tests/test_regexopt.py @@ -3,7 +3,7 @@ Tests for pygments.regexopt ~~~~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_rtf_formatter.py b/tests/test_rtf_formatter.py index 25784743..756c03a9 100644 --- a/tests/test_rtf_formatter.py +++ b/tests/test_rtf_formatter.py @@ -3,7 +3,7 @@ Pygments RTF formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_ruby.py b/tests/test_ruby.py index ab210bad..b7d4110a 100644 --- a/tests/test_ruby.py +++ b/tests/test_ruby.py @@ -3,7 +3,7 @@ Basic RubyLexer Test ~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_shell.py b/tests/test_shell.py index 6faac9fd..e283793e 100644 --- a/tests/test_shell.py +++ b/tests/test_shell.py @@ -3,7 +3,7 @@ Basic Shell Tests ~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_smarty.py b/tests/test_smarty.py index 450e4e6b..e1e079d9 100644 --- a/tests/test_smarty.py +++ b/tests/test_smarty.py @@ -3,7 +3,7 @@ Basic SmartyLexer Test ~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_string_asserts.py b/tests/test_string_asserts.py index ba7b37fa..5e9e5617 100644 --- a/tests/test_string_asserts.py +++ b/tests/test_string_asserts.py @@ -3,7 +3,7 @@ Pygments string assert utility tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_terminal_formatter.py b/tests/test_terminal_formatter.py index cb5c6c44..ee0ac380 100644 --- a/tests/test_terminal_formatter.py +++ b/tests/test_terminal_formatter.py @@ -3,7 +3,7 @@ Pygments terminal formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_textfmts.py b/tests/test_textfmts.py index d355ab68..453dd61f 100644 --- a/tests/test_textfmts.py +++ b/tests/test_textfmts.py @@ -3,7 +3,7 @@ Basic Tests for textfmts ~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_token.py b/tests/test_token.py index 0c6b02bf..94522373 100644 --- a/tests/test_token.py +++ b/tests/test_token.py @@ -3,7 +3,7 @@ Test suite for the token module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_unistring.py b/tests/test_unistring.py index a414347c..c56b68c7 100644 --- a/tests/test_unistring.py +++ b/tests/test_unistring.py @@ -3,7 +3,7 @@ Test suite for the unistring module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_using_api.py b/tests/test_using_api.py index 16d865e6..7517ce7d 100644 --- a/tests/test_using_api.py +++ b/tests/test_using_api.py @@ -3,7 +3,7 @@ Pygments tests for using() ~~~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_util.py b/tests/test_util.py index 720b384a..cdb58b3f 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -3,7 +3,7 @@ Test suite for the util module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ |