~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_msgeditor.py

  • Committer: Aaron Bentley
  • Date: 2005-12-12 17:14:42 UTC
  • mto: (1185.60.3 Aaron's mergeable stuff)
  • mto: This revision was merged to the branch mainline in revision 1530.
  • Revision ID: abentley@panoramicfeedback.com-20051212171442-c5eeec64016bb1f7
Use unicode pathname in cmd_missing

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2005 by Canonical Ltd
 
2
#
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License version 2 as published by
 
5
# the Free Software Foundation.
 
6
#
 
7
# This program is distributed in the hope that it will be useful,
 
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
# GNU General Public License for more details.
 
11
#
 
12
# You should have received a copy of the GNU General Public License
 
13
# along with this program; if not, write to the Free Software
 
14
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
 
 
16
"""Test commit message editor.
 
17
"""
 
18
 
 
19
import os
 
20
import sys
 
21
 
 
22
from bzrlib.branch import Branch
 
23
from bzrlib.msgeditor import make_commit_message_template
 
24
from bzrlib.tests import TestCaseInTempDir
 
25
 
 
26
from bzrlib.tests.treeshape import build_tree_contents
 
27
 
 
28
 
 
29
def make_uncommitted_tree():
 
30
    """Build a branch with uncommitted changes in the cwd."""
 
31
    b = Branch.initialize('.')
 
32
    working_tree = b.working_tree()
 
33
    filename = u'hell\u00d8'
 
34
    build_tree_contents([(filename, 'contents of hello')])
 
35
    working_tree.add(filename)
 
36
    return working_tree
 
37
 
 
38
 
 
39
class MsgEditorTest(TestCaseInTempDir):
 
40
 
 
41
    def test_commit_template(self):
 
42
        """Test building a commit message template"""
 
43
        working_tree = make_uncommitted_tree()
 
44
        template = make_commit_message_template(working_tree, None)
 
45
        self.assertEqualDiff(template,
 
46
u"""\
 
47
added:
 
48
  hell\u00d8
 
49
""")