1
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
1
# Copyright (C) 2008-2011, 2016 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
28
31
def test_list_alias_with_none(self):
29
32
"""Calling alias with no parameters lists existing aliases."""
30
33
out, err = self.run_bzr('alias')
31
self.assertEquals('', out)
34
self.assertEqual('', out)
33
36
def test_list_unknown_alias(self):
34
37
out, err = self.run_bzr('alias commit')
35
self.assertEquals('bzr alias: commit: not found\n', out)
38
self.assertEqual('bzr alias: commit: not found\n', out)
37
40
def test_add_alias_outputs_nothing(self):
38
41
out, err = self.run_bzr('alias commit="commit --strict"')
39
self.assertEquals('', out)
42
self.assertEqual('', out)
41
44
def test_add_alias_visible(self):
42
45
"""Adding an alias makes it ..."""
43
46
self.run_bzr('alias commit="commit --strict"')
44
47
out, err = self.run_bzr('alias commit')
45
self.assertEquals('bzr alias commit="commit --strict"\n', out)
48
self.assertEqual('bzr alias commit="commit --strict"\n', out)
47
50
def test_unicode_alias(self):
48
51
"""Unicode aliases should work (Bug #529930)"""
49
52
# XXX: strictly speaking, lack of unicode filenames doesn't imply that
50
53
# unicode command lines aren't available.
51
self.requireFeature(tests.UnicodeFilenameFeature)
54
self.requireFeature(features.UnicodeFilenameFeature)
52
55
file_name = u'foo\xb6'
54
57
tree = self.make_branch_and_tree('.')
60
63
u'[ALIASES]\nust=st %s\n' % (file_name,), save=True)
62
65
out, err = self.run_bzr('ust')
63
self.assertEquals(err, '')
64
self.assertEquals(out, '')
66
self.assertEqual(err, '')
67
self.assertEqual(out, '')
66
69
def test_alias_listing_alphabetical(self):
67
70
self.run_bzr('alias commit="commit --strict"')
69
72
self.run_bzr('alias add="add -q"')
71
74
out, err = self.run_bzr('alias')
73
76
'bzr alias add="add -q"\n'
74
77
'bzr alias commit="commit --strict"\n'
75
78
'bzr alias ll="log --short"\n',
78
81
def test_remove_unknown_alias(self):
79
82
out, err = self.run_bzr('alias --remove fooix', retcode=3)
80
self.assertEquals('bzr: ERROR: The alias "fooix" does not exist.\n',
83
self.assertEqual('bzr: ERROR: The alias "fooix" does not exist.\n',
83
86
def test_remove_known_alias(self):
84
87
self.run_bzr('alias commit="commit --strict"')
85
88
out, err = self.run_bzr('alias commit')
86
self.assertEquals('bzr alias commit="commit --strict"\n', out)
89
self.assertEqual('bzr alias commit="commit --strict"\n', out)
87
90
# No output when removing an existing alias.
88
91
out, err = self.run_bzr('alias --remove commit')
89
self.assertEquals('', out)
92
self.assertEqual('', out)
91
94
out, err = self.run_bzr('alias commit')
92
self.assertEquals("bzr alias: commit: not found\n", out)
95
self.assertEqual("bzr alias: commit: not found\n", out)