~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testlog.py

  • Committer: Harald Meland
  • Date: 2005-10-06 22:55:44 UTC
  • mto: (1185.33.32 bzr.dev)
  • mto: This revision was merged to the branch mainline in revision 1509.
  • Revision ID: hmeland@twoflower.uio.no-20051006225544-bc7ef2300f20d9a3
Cleanup + better test of commit-msg control character escape code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
153
153
        
154
154
        # commit a log message with control characters
155
155
        msg = "All 8-bit chars: " +  ''.join([unichr(x) for x in range(256)])
 
156
        self.log("original commit message: %r", msg)
156
157
        b.commit(msg)
157
158
        lf = LogCatcher()
158
159
        show_log(b, lf, verbose=True)
160
161
        self.log("escaped commit message: %r", committed_msg)
161
162
        self.assert_(msg != committed_msg)
162
163
        self.assert_(len(committed_msg) > len(msg))
 
164
 
 
165
        # Check that log message with only XML-valid characters isn't
 
166
        # escaped.  As ElementTree apparently does some kind of
 
167
        # newline conversion, neither LF (\x0A) nor CR (\x0D) are
 
168
        # included in the test commit message, even though they are
 
169
        # valid XML 1.0 characters.
 
170
        msg = "\x09" + ''.join([unichr(x) for x in range(0x20, 256)])
 
171
        self.log("original commit message: %r", msg)
 
172
        b.commit(msg)
 
173
        lf = LogCatcher()
 
174
        show_log(b, lf, verbose=True)
 
175
        committed_msg = lf.logs[0].rev.message
 
176
        self.log("escaped commit message: %r", committed_msg)
 
177
        self.assert_(msg == committed_msg)