# HG changeset patch # User catherine.devlin@gmail.com # Date 1289130495 18000 # Node ID be18c88a0fc8b7db1f507e9e43360c45e5729aeb # Parent 3397b9c199f58b7e971a2a8071ca93835886dab4 report when end of transcript never seen diff -r 3397b9c199f5 -r be18c88a0fc8 cmd2.py --- a/cmd2.py Tue Sep 21 15:25:56 2010 -0400 +++ b/cmd2.py Sun Nov 07 06:48:15 2010 -0500 @@ -1482,14 +1482,17 @@ lineNum = 0 try: line = transcript.next() + lineNum += 1 while True: while not line.startswith(self.cmdapp.prompt): line = transcript.next() + lineNum += 1 command = [line[len(self.cmdapp.prompt):]] line = transcript.next() while line.startswith(self.cmdapp.continuation_prompt): command.append(line[len(self.cmdapp.continuation_prompt):]) line = transcript.next() + lineNum += 1 command = ''.join(command) stop = self.cmdapp.onecmd_plus_hooks(command) #TODO: should act on ``stop`` @@ -1503,6 +1506,7 @@ while not line.startswith(self.cmdapp.prompt): expected.append(line) line = transcript.next() + lineNum += 1 expected = ''.join(expected) message = '\nFile %s, line %d\nCommand was:\n%s\nExpected:\n%s\nGot:\n%s\n'%\ (fname, lineNum, command, expected, result) @@ -1512,7 +1516,8 @@ result = self.anyWhitespace.sub('', result) self.assert_(re.match(expected, result, re.MULTILINE | re.DOTALL), message) except StopIteration: - pass + message = 'Last %d lines never seen, beginning with\n%s' % (len(expected), expected[0]) + self.assert_(len(expected) < 3, message) def tearDown(self): if self.CmdApp: self.outputTrap.tearDown()