18
18
"""Tests of the 'bzr alias' command."""
24
from bzrlib.tests import (
29
class TestAlias(tests.TestCaseWithTransport):
20
from bzrlib.tests.blackbox import ExternalBase
23
class TestAlias(ExternalBase):
31
25
def test_list_alias_with_none(self):
32
26
"""Calling alias with no parameters lists existing aliases."""
33
27
out, err = self.run_bzr('alias')
34
self.assertEqual('', out)
28
self.assertEquals('', out)
36
30
def test_list_unknown_alias(self):
37
31
out, err = self.run_bzr('alias commit')
38
self.assertEqual('bzr alias: commit: not found\n', out)
32
self.assertEquals('bzr alias: commit: not found\n', out)
40
34
def test_add_alias_outputs_nothing(self):
41
35
out, err = self.run_bzr('alias commit="commit --strict"')
42
self.assertEqual('', out)
36
self.assertEquals('', out)
44
38
def test_add_alias_visible(self):
45
39
"""Adding an alias makes it ..."""
46
40
self.run_bzr('alias commit="commit --strict"')
47
41
out, err = self.run_bzr('alias commit')
48
self.assertEqual('bzr alias commit="commit --strict"\n', out)
50
def test_unicode_alias(self):
51
"""Unicode aliases should work (Bug #529930)"""
52
# XXX: strictly speaking, lack of unicode filenames doesn't imply that
53
# unicode command lines aren't available.
54
self.requireFeature(features.UnicodeFilenameFeature)
55
file_name = u'foo\xb6'
57
tree = self.make_branch_and_tree('.')
58
self.build_tree([file_name])
62
config.GlobalConfig.from_string(
63
u'[ALIASES]\nust=st %s\n' % (file_name,), save=True)
65
out, err = self.run_bzr('ust')
66
self.assertEqual(err, '')
67
self.assertEqual(out, '')
42
self.assertEquals('bzr alias commit="commit --strict"\n', out)
69
44
def test_alias_listing_alphabetical(self):
70
45
self.run_bzr('alias commit="commit --strict"')
81
56
def test_remove_unknown_alias(self):
82
57
out, err = self.run_bzr('alias --remove fooix', retcode=3)
83
self.assertEqual('bzr: ERROR: The alias "fooix" does not exist.\n',
58
self.assertEquals('bzr: ERROR: The alias "fooix" does not exist.\n',
86
61
def test_remove_known_alias(self):
87
62
self.run_bzr('alias commit="commit --strict"')
88
63
out, err = self.run_bzr('alias commit')
89
self.assertEqual('bzr alias commit="commit --strict"\n', out)
64
self.assertEquals('bzr alias commit="commit --strict"\n', out)
90
65
# No output when removing an existing alias.
91
66
out, err = self.run_bzr('alias --remove commit')
92
self.assertEqual('', out)
67
self.assertEquals('', out)
94
69
out, err = self.run_bzr('alias commit')
95
self.assertEqual("bzr alias: commit: not found\n", out)
70
self.assertEquals("bzr alias: commit: not found\n", out)