1
# Copyright (C) 2006, 2007, 2009, 2010 Canonical Ltd
1
# Copyright (C) 2006, 2007, 2009, 2010, 2011 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
22
22
from bzrlib.tests import script
24
25
def make_tree_with_conflicts(test, this_path='this', other_path='other',
26
27
this_tree = test.make_branch_and_tree(this_path)
80
81
Path conflict: mydir3 / mydir2
81
82
Text conflict in myfile
86
class TestUnicodePaths(tests.TestCaseWithTransport):
87
"""Unicode characters in conflicts should be displayed properly"""
91
def _as_output(self, text):
94
def test_messages(self):
95
"""Conflict messages involving non-ascii paths are displayed okay"""
96
make_tree_with_conflicts(self, "branch", prefix=u"\xA7")
97
out, err = self.run_bzr(["conflicts", "-d", "branch"],
98
encoding=self.encoding)
99
self.assertEqual(out.decode(self.encoding),
100
u"Text conflict in \xA7_other_file\n"
101
u"Path conflict: \xA7dir3 / \xA7dir2\n"
102
u"Text conflict in \xA7file\n")
103
self.assertEqual(err, "")
105
def test_text_conflict_paths(self):
106
"""Text conflicts on non-ascii paths are displayed okay"""
107
make_tree_with_conflicts(self, "branch", prefix=u"\xA7")
108
out, err = self.run_bzr(["conflicts", "-d", "branch", "--text"],
109
encoding=self.encoding)
110
self.assertEqual(out.decode(self.encoding),
113
self.assertEqual(err, "")
116
class TestUnicodePathsOnAsciiTerminal(TestUnicodePaths):
117
"""Undisplayable unicode characters in conflicts should be escaped"""
122
self.skip("Need to decide if replacing is the desired behaviour")
124
def _as_output(self, text):
125
return text.encode(self.encoding, "replace")