diff options
author | Lars Wirzenius <liw@liw.fi> | 2013-06-23 09:27:14 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2013-06-23 09:27:14 +0100 |
commit | c54bcf443bb1243d9cb14fef598b3901dd66f51e (patch) | |
tree | 91eae72a0b700fd632da5329e250a9afc461920e | |
parent | bec45232f5775bc934a638e3095ac77f78176708 (diff) | |
download | cmdtest-c54bcf443bb1243d9cb14fef598b3901dd66f51e.tar.gz |
Add warning when an input file has no scenario code blocks
-rwxr-xr-x | yarn | 4 | ||||
-rwxr-xr-x | yarn.tests/warn-if-empty.script | 10 |
2 files changed, 13 insertions, 1 deletions
@@ -68,7 +68,9 @@ class YarnRunner(cliapp.Application): def parse_scenarios(self, filenames): mdparser = yarnlib.MarkdownParser() for filename in filenames: - mdparser.parse_file(filename) + blocks = mdparser.parse_file(filename) + if not blocks: + logging.warning('No scenario code blocks in %s' % filename) block_parser = yarnlib.BlockParser() block_parser.parse_blocks(mdparser.blocks) diff --git a/yarn.tests/warn-if-empty.script b/yarn.tests/warn-if-empty.script new file mode 100755 index 0000000..7a5c028 --- /dev/null +++ b/yarn.tests/warn-if-empty.script @@ -0,0 +1,10 @@ +#!/bin/sh + +set -eu + +touch "$DATADIR/empty.yarn" + +# The grep below will fail unless the string exists, thereby failing the +# entire test. +./yarn --log=/dev/stdout "$DATADIR/empty.yarn" | + grep 'No scenario code blocks' > /dev/null |