diff options
author | Lars Wirzenius <liw@liw.fi> | 2013-06-19 20:42:58 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2013-06-19 20:42:58 +0100 |
commit | 2c288169fd38032575feb4414c039e9c1e9e8764 (patch) | |
tree | 365b3467e08cac322943ce00830dfb140fcfb77a /yarnlib/block_parser.py | |
parent | 54e347e461327c09746b45d19b1d24631652da8e (diff) | |
download | cmdtest-2c288169fd38032575feb4414c039e9c1e9e8764.tar.gz |
Switch to "scenario testing"
Diffstat (limited to 'yarnlib/block_parser.py')
-rw-r--r-- | yarnlib/block_parser.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/yarnlib/block_parser.py b/yarnlib/block_parser.py index 1a600ee..84074e2 100644 --- a/yarnlib/block_parser.py +++ b/yarnlib/block_parser.py @@ -26,16 +26,16 @@ class BlockError(cliapp.AppException): pass -# Parse a sequence of textual blocks into Story and Implementation +# Parse a sequence of textual blocks into scenario and Implementation # objects, and their constituent objects. class BlockParser(object): def __init__(self): - self.stories = [] + self.scenarios = [] self.implementations = [] self.line_parsers = { - 'STORY': self.parse_story, + 'SCENARIO': self.parse_scenario, 'GIVEN': self.parse_given, 'WHEN': self.parse_when, 'THEN': self.parse_then, @@ -75,15 +75,15 @@ class BlockParser(object): raise BlockError("Syntax error: unknown step: %s" % line1) - def parse_story(self, line, blocks): - self.stories.append(yarnlib.Story(line)) + def parse_scenario(self, line, blocks): + self.scenarios.append(yarnlib.Scenario(line)) return blocks def parse_simple(self, what, line, blocks): - if not self.stories: - raise BlockError('Syntax errror: %s before STORY' % what) - step = yarnlib.StoryStep(what, line) - self.stories[-1].steps.append(step) + if not self.scenarios: + raise BlockError('Syntax errror: %s before SCENARIO' % what) + step = yarnlib.ScenarioStep(what, line) + self.scenarios[-1].steps.append(step) return blocks def parse_given(self, line, blocks): @@ -99,13 +99,13 @@ class BlockParser(object): return self.parse_simple('FINALLY', line, blocks) def parse_and(self, line, blocks): - if not self.stories: - raise BlockError('Syntax errror: AND before STORY') - story = self.stories[-1] - if not story.steps: + if not self.scenarios: + raise BlockError('Syntax errror: AND before SCENARIO') + scenario = self.scenarios[-1] + if not scenario.steps: raise BlockError( 'Syntax errror: AND before what it would continue') - step = story.steps[-1] + step = scenario.steps[-1] assert step.what in self.line_parsers return self.line_parsers[step.what](line, blocks) |