~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_msgeditor.py

  • Committer: Aaron Bentley
  • Date: 2007-05-14 17:21:02 UTC
  • mfrom: (2485 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2528.
  • Revision ID: aaron.bentley@utoronto.ca-20070514172102-byyl4ldjxhfxvryy
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
187
187
                del os.environ['EDITOR']
188
188
            else:
189
189
                os.environ['EDITOR'] = editor
 
190
 
 
191
    def test__create_temp_file_with_commit_template(self):
 
192
        # check that commit template written properly
 
193
        # and has platform native line-endings (CRLF on win32)
 
194
        create_file = bzrlib.msgeditor._create_temp_file_with_commit_template
 
195
        msgfilename, hasinfo = create_file('infotext','----','start message')
 
196
        self.assertNotEqual(None, msgfilename)
 
197
        self.assertTrue(hasinfo)
 
198
        expected = os.linesep.join(['start message',
 
199
                                    '',
 
200
                                    '',
 
201
                                    '----',
 
202
                                    '',
 
203
                                    'infotext'])
 
204
        self.assertFileEqual(expected, msgfilename)
 
205
 
 
206
    def test__create_temp_file_with_empty_commit_template(self):
 
207
        # empty file
 
208
        create_file = bzrlib.msgeditor._create_temp_file_with_commit_template
 
209
        msgfilename, hasinfo = create_file('')
 
210
        self.assertNotEqual(None, msgfilename)
 
211
        self.assertFalse(hasinfo)
 
212
        self.assertFileEqual('', msgfilename)