18
18
"""Tests of the 'bzr alias' command."""
20
from bzrlib.tests.blackbox import ExternalBase
23
class TestAlias(ExternalBase):
24
from bzrlib.tests import (
29
class TestAlias(tests.TestCaseWithTransport):
25
31
def test_list_alias_with_none(self):
26
32
"""Calling alias with no parameters lists existing aliases."""
27
33
out, err = self.run_bzr('alias')
28
self.assertEquals('', out)
34
self.assertEqual('', out)
30
36
def test_list_unknown_alias(self):
31
37
out, err = self.run_bzr('alias commit')
32
self.assertEquals('bzr alias: commit: not found\n', out)
38
self.assertEqual('bzr alias: commit: not found\n', out)
34
40
def test_add_alias_outputs_nothing(self):
35
41
out, err = self.run_bzr('alias commit="commit --strict"')
36
self.assertEquals('', out)
42
self.assertEqual('', out)
38
44
def test_add_alias_visible(self):
39
45
"""Adding an alias makes it ..."""
40
46
self.run_bzr('alias commit="commit --strict"')
41
47
out, err = self.run_bzr('alias commit')
42
self.assertEquals('bzr alias commit="commit --strict"\n', out)
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, '')
44
69
def test_alias_listing_alphabetical(self):
45
70
self.run_bzr('alias commit="commit --strict"')
56
81
def test_remove_unknown_alias(self):
57
82
out, err = self.run_bzr('alias --remove fooix', retcode=3)
58
self.assertEquals('bzr: ERROR: The alias "fooix" does not exist.\n',
83
self.assertEqual('bzr: ERROR: The alias "fooix" does not exist.\n',
61
86
def test_remove_known_alias(self):
62
87
self.run_bzr('alias commit="commit --strict"')
63
88
out, err = self.run_bzr('alias commit')
64
self.assertEquals('bzr alias commit="commit --strict"\n', out)
89
self.assertEqual('bzr alias commit="commit --strict"\n', out)
65
90
# No output when removing an existing alias.
66
91
out, err = self.run_bzr('alias --remove commit')
67
self.assertEquals('', out)
92
self.assertEqual('', out)
69
94
out, err = self.run_bzr('alias commit')
70
self.assertEquals("bzr alias: commit: not found\n", out)
95
self.assertEqual("bzr alias: commit: not found\n", out)