summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatherine Devlin <catherine.devlin@gmail.com>2010-11-08 04:27:13 -0500
committerCatherine Devlin <catherine.devlin@gmail.com>2010-11-08 04:27:13 -0500
commita2a5c3912b3959b8bd0198aab7c0f5eaf40c13ec (patch)
tree249871a5a5f46607579ad88b745d6c6afa12c1ce
parent0527313302221e1ea39830b7d40dd21d1198e335 (diff)
downloadcmd2-hg-a2a5c3912b3959b8bd0198aab7c0f5eaf40c13ec.tar.gz
before changing StopIteration catch
-rwxr-xr-xcmd2.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd2.py b/cmd2.py
index 6506678..fac59cd 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -1484,19 +1484,23 @@ class Cmd2TestCase(unittest.TestCase):
line = transcript.next()
lineNum += 1
while True:
+ # Scroll forward to where actual commands begin
while not line.startswith(self.cmdapp.prompt):
line = transcript.next()
lineNum += 1
command = [line[len(self.cmdapp.prompt):]]
line = transcript.next()
+ # Read the entirety of a multi-line command
while line.startswith(self.cmdapp.continuation_prompt):
command.append(line[len(self.cmdapp.continuation_prompt):])
line = transcript.next()
lineNum += 1
command = ''.join(command)
+ # Send the command into the application and capture the resulting output
stop = self.cmdapp.onecmd_plus_hooks(command)
#TODO: should act on ``stop``
result = self.outputTrap.read()
+ # Read the expected result from transcript
if line.startswith(self.cmdapp.prompt):
message = '\nFile %s, line %d\nCommand was:\n%s\nExpected: (nothing)\nGot:\n%s\n'%\
(fname, lineNum, command, result)
@@ -1508,6 +1512,7 @@ class Cmd2TestCase(unittest.TestCase):
line = transcript.next()
lineNum += 1
expected = ''.join(expected)
+ # Compare actual result to expected
message = '\nFile %s, line %d\nCommand was:\n%s\nExpected:\n%s\nGot:\n%s\n'%\
(fname, lineNum, command, expected, result)
expected = self.expectationParser.transformString(expected)