diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/blexer-block-code.md | 10 | ||||
-rw-r--r-- | tests/test_md_tw.py | 19 |
2 files changed, 27 insertions, 2 deletions
diff --git a/tests/data/blexer-block-code.md b/tests/data/blexer-block-code.md new file mode 100644 index 0000000..711763a --- /dev/null +++ b/tests/data/blexer-block-code.md @@ -0,0 +1,10 @@ +Let's have some chaos: + + $ echo 'Zap!' + $ rm -rf / + +> Some Jaromil art inside a block quote +> +> $ :(){:|:&};: +> +> For more look at jaramil.dyne.org. He's awesome. diff --git a/tests/test_md_tw.py b/tests/test_md_tw.py index c06a267..2496f43 100644 --- a/tests/test_md_tw.py +++ b/tests/test_md_tw.py @@ -40,8 +40,23 @@ class TestTWBlockLexer(object): def setup(self): self.bl = TWBlockLexer() - - + def _parse(self, file_): + txt = _get_data(file_) + return self.bl.parse(txt) + + def _validate(self, tokens, type_, expected): + for token in tokens: + if token['type'] == type_: + assert_equal(token['text'], expected.pop(0)) + + def test_parse_block_code(self): + tokens = self._parse('blexer-block-code.md') + + expected_bc = [ + ' $ echo \'Zap!\'\n $ rm -rf /\n\n', + ' $ :(){:|:&};:\n\n' + ] + self._validate(tokens, 'code', expected_bc) def teardown(self): pass |