diff options
author | Lars Wirzenius <liw@liw.fi> | 2013-06-23 08:58:08 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2013-06-23 08:58:08 +0100 |
commit | 4d5992fd7bc2a49cd31a8eb36c01b9dc3c2480e5 (patch) | |
tree | 2e47a8b74d9de8865c64f5b24176d5c18101acee | |
parent | 4df14179ddf911a451e0538b9a14e0190d27c82a (diff) | |
parent | fb51edb928cdee71bb3445b6f543fc69fbd46dc4 (diff) | |
download | cmdtest-4d5992fd7bc2a49cd31a8eb36c01b9dc3c2480e5.tar.gz |
Merge branch 'liw/multiple-input-files'
-rw-r--r-- | NEWS | 7 | ||||
-rw-r--r-- | setup.py | 3 | ||||
-rwxr-xr-x | yarn.tests/multi.script | 23 | ||||
-rw-r--r-- | yarn.tests/multi.stdout | 1 | ||||
-rw-r--r-- | yarn.tests/simple.stderr | 4 | ||||
-rw-r--r-- | yarnlib/mdparser.py | 2 | ||||
-rw-r--r-- | yarnlib/mdparser_tests.py | 9 |
7 files changed, 46 insertions, 3 deletions
@@ -3,6 +3,13 @@ NEWS for cmdtest This file summarizes changes between releases of cmdtest. +Version 0.X, released UNRELEASED +-------------------------------- + +* Bug fix: yarn now handles multiple input files correctly. + Reported by Daniel Silverstone; fix based on his patch, but + rewritten. + Version 0.8.3, released 2013-06-21 -------------------------------- @@ -89,6 +89,9 @@ class Check(Command): else: raise Exception('fail-tests did not fail, which is a surprise') + if markdown_version: + subprocess.check_call(['./cmdtest', 'yarn.tests']) + setup(name='cmdtest', version=cmdtestlib.__version__, diff --git a/yarn.tests/multi.script b/yarn.tests/multi.script new file mode 100755 index 0000000..35818fa --- /dev/null +++ b/yarn.tests/multi.script @@ -0,0 +1,23 @@ +#!/bin/sh + +set -eu + + +cat <<EOF > "$DATADIR/1.yarn" + SCENARIO foo + GIVEN all is ok + WHEN doing ok + THEN be ok +EOF + +cat <<EOF > "$DATADIR/2.yarn" + IMPLEMENTS GIVEN all is ok + true + IMPLEMENTS WHEN doing ok + true + IMPLEMENTS THEN be ok + true +EOF + +./yarn "$DATADIR/1.yarn" "$DATADIR/2.yarn" | +sed 's/, in .* seconds$//' diff --git a/yarn.tests/multi.stdout b/yarn.tests/multi.stdout new file mode 100644 index 0000000..22c4303 --- /dev/null +++ b/yarn.tests/multi.stdout @@ -0,0 +1 @@ +Scenario test suite PASS, with 1 scenarios diff --git a/yarn.tests/simple.stderr b/yarn.tests/simple.stderr index db4fde4..3df1113 100644 --- a/yarn.tests/simple.stderr +++ b/yarn.tests/simple.stderr @@ -1,7 +1,7 @@ -ERROR: In story "a simple story" +ERROR: In scenario "a simple scenario" step "THEN not all is well" failed, with exit code 1: Standard output from shell command: Standard error from shell command: -ERROR: Test suite FAILED in 1 stories +ERROR: Test suite FAILED in 1 scenarios 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']) + |