Mercurial > python-cmd2
changeset 409:130889170679
before changing StopIteration catch
author | Catherine Devlin <catherine.devlin@gmail.com> |
---|---|
date | Mon, 08 Nov 2010 04:27:13 -0500 |
parents | a53ba40b9848 |
children | 48ebbdfe9dd4 |
files | cmd2.py |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/cmd2.py Sun Nov 07 21:30:13 2010 -0500 +++ b/cmd2.py Mon Nov 08 04:27:13 2010 -0500 @@ -1484,19 +1484,23 @@ 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 @@ 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)