diff options
| author | Catherine Devlin <catherine.devlin@gmail.com> | 2008-10-24 16:13:47 -0400 |
|---|---|---|
| committer | Catherine Devlin <catherine.devlin@gmail.com> | 2008-10-24 16:13:47 -0400 |
| commit | 1dc7f18a1c18e955ec4bf8ed7fac8c9a287fd090 (patch) | |
| tree | ecfb4a080a147ed7b870ea1aa59a95fa4c4cf966 | |
| parent | 19140febc22184c8d3079eceadfe42803be6debf (diff) | |
| download | cmd2-git-1dc7f18a1c18e955ec4bf8ed7fac8c9a287fd090.tar.gz | |
vigorous whitespace stripping from test results
| -rwxr-xr-x | cmd2/cmd2.py | 5 | ||||
| -rw-r--r-- | cmd2/exampleSession.txt | 5 |
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 |
