summaryrefslogtreecommitdiff
path: root/yarnlib
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2013-06-23 08:47:02 +0100
committerLars Wirzenius <liw@liw.fi>2013-06-23 08:47:02 +0100
commitce118d6418eda1a41f5f2446ffc1ed833ba07dbb (patch)
treeab3a49a801647de6afc5e543aae970aad910f8bb /yarnlib
parent4df14179ddf911a451e0538b9a14e0190d27c82a (diff)
downloadcmdtest-ce118d6418eda1a41f5f2446ffc1ed833ba07dbb.tar.gz
Allow MarkdownParser to parse multiple files
Reported-by: Daniel Silverstone
Diffstat (limited to 'yarnlib')
-rw-r--r--yarnlib/mdparser.py2
-rw-r--r--yarnlib/mdparser_tests.py9
2 files changed, 10 insertions, 1 deletions
diff --git a/yarnlib/mdparser.py b/yarnlib/mdparser.py
index 6708369..9917f8b 100644
--- a/yarnlib/mdparser.py
+++ b/yarnlib/mdparser.py
@@ -67,7 +67,7 @@ class MarkdownParser(object):
ext = ParseScenarioTestBlocks()
f = StringIO.StringIO()
markdown.markdown(text, output=f, extensions=[ext])
- self.blocks = ext.blocks
+ self.blocks.extend(ext.blocks)
def parse_file(self, filename): # pragma: no cover
with open(filename) as f:
diff --git a/yarnlib/mdparser_tests.py b/yarnlib/mdparser_tests.py
index af0c7af..a9b9cb7 100644
--- a/yarnlib/mdparser_tests.py
+++ b/yarnlib/mdparser_tests.py
@@ -82,3 +82,12 @@ More text.
''')
self.assertEqual(self.parser.blocks, ['this is a code block\n'])
+ def test_parses_multiple_files(self):
+ self.parser.parse_string('''
+ block 1
+''')
+ self.parser.parse_string('''
+ block 2
+''')
+ self.assertEqual(self.parser.blocks, ['block 1\n', 'block 2\n'])
+