summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatherine Devlin <catherine.devlin@gmail.com>2008-10-24 16:13:47 -0400
committerCatherine Devlin <catherine.devlin@gmail.com>2008-10-24 16:13:47 -0400
commit1dc7f18a1c18e955ec4bf8ed7fac8c9a287fd090 (patch)
treeecfb4a080a147ed7b870ea1aa59a95fa4c4cf966
parent19140febc22184c8d3079eceadfe42803be6debf (diff)
downloadcmd2-git-1dc7f18a1c18e955ec4bf8ed7fac8c9a287fd090.tar.gz
vigorous whitespace stripping from test results
-rwxr-xr-xcmd2/cmd2.py5
-rw-r--r--cmd2/exampleSession.txt5
2 files changed, 7 insertions, 3 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index afcb53f7..9eadd025 100755
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -762,9 +762,12 @@ class Cmd2TestCase(unittest.TestCase):
self.cmdapp.onecmd(cmdInput)
result = self.outputTrap.read()
expected = self.transcriptReader.nextExpected()
- self.assertEqual(result.strip(), expected.strip(),
+ self.assertEqual(self.stripByLine(result), self.stripByLine(expected),
'\nFile %s, line %d\nCommand was:\n%s\nExpected:\n%s\nGot:\n%s\n' %
(self.transcriptFileName, lineNum, cmdInput, expected, result))
+ def stripByLine(self, s):
+ lines = s.splitlines()
+ return '\n'.join(line.rstrip() for line in lines).strip()
def tearDown(self):
if self.CmdApp:
self.outputTrap.tearDown()
diff --git a/cmd2/exampleSession.txt b/cmd2/exampleSession.txt
index b91fca67..eddf9d27 100644
--- a/cmd2/exampleSession.txt
+++ b/cmd2/exampleSession.txt
@@ -14,7 +14,7 @@ Options:
(Cmd) say --shout goodnight, Gracie
GOODNIGHT, GRACIE
(Cmd) set prompt 'example >>> '
-prompt - was: (Cmd)
+prompt - was: (Cmd)
now: example >>>
example >>> say --repeat 5 spam
spam
@@ -33,4 +33,5 @@ spam
spam
spam
spam
-spam \ No newline at end of file
+spam
+example >>> \ No newline at end of file