summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcatherine devlin <catherine.devlin@gmail.com>2010-11-07 06:48:15 -0500
committercatherine devlin <catherine.devlin@gmail.com>2010-11-07 06:48:15 -0500
commit34471c1e51cfde2c61bfd1af4fce6bcde5e06178 (patch)
tree0f5b773ae0e6876b83346ff2527877f72d726107
parent7b1f5fbab4d5411cde4531d279c738a484e282e8 (diff)
downloadcmd2-hg-34471c1e51cfde2c61bfd1af4fce6bcde5e06178.tar.gz
report when end of transcript never seen
-rwxr-xr-xcmd2.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd2.py b/cmd2.py
index 5e8209c..8c63f6d 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -1482,14 +1482,17 @@ class Cmd2TestCase(unittest.TestCase):
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 @@ class Cmd2TestCase(unittest.TestCase):
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 @@ class Cmd2TestCase(unittest.TestCase):
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()