diff options
| author | Christian Hammond <christian@beanbaginc.com> | 2016-11-04 16:57:38 -0700 |
|---|---|---|
| committer | Christian Hammond <christian@beanbaginc.com> | 2016-11-04 16:57:38 -0700 |
| commit | 6ded9db39463372e5205a36bea72d6de516ece69 (patch) | |
| tree | 1d1f497cc99dd44d2ee7e2c3daa35965157ff924 /tests/test_string_asserts.py | |
| download | pygments-git-6ded9db39463372e5205a36bea72d6de516ece69.tar.gz | |
Add support for partials and path segments for Handlebars.
This introduces support for some missing features to the Handlebars lexer:
Partials and path segments. Partials mostly appeared to work before, but the
`>` in `{{> ... }}` would appear as a syntax error, as could other
components of the partial. This change introduces support for:
* Standard partials: `{{> partialName}}`
* Partials with parameters: `{{> partialName varname="value"}}`
* Ddynamic partials: `{{> (partialFunc)}}`
* Ddynamic partials with lookups: `{{> (lookup ../path "partialName")}}`
* Partial blocks: `{{> @partial-block}}`
* Inline partials: `{{#*inline}}..{{/inline}}`
It also introduces support for path segments, which can reference content in
the current context or in a parent context. For instance, `this.name`,
`this/name`, `./name`, `../name`, `this/name`, etc. These are all now tracked
as variables.
Diffstat (limited to 'tests/test_string_asserts.py')
| -rw-r--r-- | tests/test_string_asserts.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/test_string_asserts.py b/tests/test_string_asserts.py new file mode 100644 index 00000000..ba7b37fa --- /dev/null +++ b/tests/test_string_asserts.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +""" + Pygments string assert utility tests + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import unittest +from string_asserts import StringTests + +class TestStringTests(StringTests, unittest.TestCase): + + def test_startswith_correct(self): + self.assertStartsWith("AAA", "A") + + # @unittest.expectedFailure not supported by nose + def test_startswith_incorrect(self): + self.assertRaises(AssertionError, self.assertStartsWith, "AAA", "B") + + # @unittest.expectedFailure not supported by nose + def test_startswith_short(self): + self.assertRaises(AssertionError, self.assertStartsWith, "A", "AA") + + def test_endswith_correct(self): + self.assertEndsWith("AAA", "A") + + # @unittest.expectedFailure not supported by nose + def test_endswith_incorrect(self): + self.assertRaises(AssertionError, self.assertEndsWith, "AAA", "B") + + # @unittest.expectedFailure not supported by nose + def test_endswith_short(self): + self.assertRaises(AssertionError, self.assertEndsWith, "A", "AA") |
