# HG changeset patch # User Catherine Devlin # Date 1289208433 18000 # Node ID 1308891706798ab6c04bb0648774c2ef4ed4ff46 # Parent a53ba40b9848a699f56c29ea8992f793032ff204 before changing StopIteration catch diff -r a53ba40b9848 -r 130889170679 cmd2.py --- 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)