13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
"""Black-box tests for bzr handling non-ascii characters."""
22
22
from bzrlib import osutils, urlutils
23
from bzrlib.tests import TestCaseWithTransport, TestSkipped
23
from bzrlib.tests import (
24
TestCaseWithTransport,
28
from bzrlib.tests.EncodingAdapter import encoding_scenarios
24
29
from bzrlib.trace import mutter, note
32
def load_tests(standard_tests, module, loader):
33
return multiply_tests(standard_tests, encoding_scenarios,
27
37
class TestNonAscii(TestCaseWithTransport):
28
38
"""Test that bzr handles files/committers/etc which are non-ascii."""
298
308
fname = self.info['filename']
299
309
txt = self.run_bzr_decode(['file-id', fname])
301
# TODO: jam 20060106 We don't support non-ascii file ids yet,
311
# TODO: jam 20060106 We don't support non-ascii file ids yet,
302
312
# so there is nothing which would fail in ascii encoding
303
313
# This *should* be retcode=3
304
314
txt = self.run_bzr_decode(['file-id', fname], encoding='ascii')
319
329
txt = self.run_bzr_decode(['file-path', path])
321
# TODO: jam 20060106 We don't support non-ascii file ids yet,
331
# TODO: jam 20060106 We don't support non-ascii file ids yet,
322
332
# so there is nothing which would fail in ascii encoding
323
333
# This *should* be retcode=3
324
334
txt = self.run_bzr_decode(['file-path', path], encoding='ascii')
326
336
def test_revision_history(self):
327
# TODO: jam 20060106 We don't support non-ascii revision ids yet,
337
# TODO: jam 20060106 We don't support non-ascii revision ids yet,
328
338
# so there is nothing which would fail in ascii encoding
329
339
txt = self.run_bzr_decode('revision-history')
331
341
def test_ancestry(self):
332
# TODO: jam 20060106 We don't support non-ascii revision ids yet,
342
# TODO: jam 20060106 We don't support non-ascii revision ids yet,
333
343
# so there is nothing which would fail in ascii encoding
334
344
txt = self.run_bzr_decode('ancestry')
336
346
def test_diff(self):
337
# TODO: jam 20060106 diff is a difficult one to test, because it
347
# TODO: jam 20060106 diff is a difficult one to test, because it
338
348
# shouldn't encode the file contents, but it needs some sort
339
349
# of encoding for the paths, etc which are displayed.
340
350
self.build_tree_contents([(self.info['filename'], 'newline\n')])
413
423
self.wt.commit(u'Renamed %s => %s' % (fname, fname2))
415
425
txt = self.run_bzr_decode(['touching-revisions', fname2])
416
expected_txt = (u' 3 added %s\n'
426
expected_txt = (u' 3 added %s\n'
417
427
u' 4 renamed %s => %s\n'
418
428
% (fname, fname, fname2))
419
429
self.assertEqual(expected_txt, txt)
436
446
fname = self.info['filename'] + '2'
437
447
self.build_tree_contents([(fname, 'unknown\n')])
439
# TODO: jam 20060112 bzr unknowns is the only one which
449
# TODO: jam 20060112 bzr unknowns is the only one which
440
450
# quotes paths do we really want it to?
441
451
# awilkins 20080521 added and modified do it now as well
442
452
txt = self.run_bzr_decode('unknowns')