~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/__init__.py

- assertEqualDiff handles strings without trailing newline

Show diffs side-by-side

added added

removed removed

Lines of Context:
173
173
        self._enable_file_logging()
174
174
 
175
175
    def _ndiff_strings(self, a, b):
176
 
        """Return ndiff between two strings containing lines."""
 
176
        """Return ndiff between two strings containing lines.
 
177
        
 
178
        A trailing newline is added if missing to make the strings
 
179
        print properly."""
 
180
        if b and b[-1] != '\n':
 
181
            b += '\n'
 
182
        if a and a[-1] != '\n':
 
183
            a += '\n'
177
184
        difflines = difflib.ndiff(a.splitlines(True),
178
185
                                  b.splitlines(True),
179
186
                                  linejunk=lambda x: False,