diff options
author | Lars Wirzenius <liw@liw.fi> | 2013-06-09 11:41:41 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2013-06-09 11:41:41 +0100 |
commit | fe8ce17ae1d9a4b1e7a2df1b9588fbe42bec2000 (patch) | |
tree | 0591afe85e056f7bbf06dc2a67a19d2fd25c2b14 /yarnlib/elements.py | |
parent | e27d5faab95ca26dd8fcb512ec09d729e1f388b4 (diff) | |
download | cmdtest-fe8ce17ae1d9a4b1e7a2df1b9588fbe42bec2000.tar.gz |
Add story element classes
Diffstat (limited to 'yarnlib/elements.py')
-rw-r--r-- | yarnlib/elements.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/yarnlib/elements.py b/yarnlib/elements.py new file mode 100644 index 0000000..a1dea0d --- /dev/null +++ b/yarnlib/elements.py @@ -0,0 +1,51 @@ +# Copyright 2013 Lars Wirzenius +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# =*= License: GPL-3+ =*= + + +# This is a step in a story: GIVEN, WHEN, THEN, etc. + +class StoryStep(object): + + def __init__(self, what, text): + self.what = what + self.text = text + self.implementation = None + + +# This is the story itself. + +class Story(object): + + def __init__(self, name): + self.name = name + self.steps = [] + + +# This is an IMPLEMENTS chunk. + +class Implementation(object): + + def __init__(self, what, regexp, shell): + self.what = what + self.regexp = regexp + self.shell = shell + + def execute(self): + exit, out, err = cliapp.runcmd_unchecked( + ['sh', '-c', 'set -eu\n' + self.shell]) + return exit + |