~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_alias.py

  • Committer: Alexander Belchenko
  • Date: 2006-07-30 16:43:12 UTC
  • mto: (1711.2.111 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1906.
  • Revision ID: bialix@ukr.net-20060730164312-b025fd3ff0cee59e
rename  gpl.txt => COPYING.txt

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
2
 
#
3
 
# This program is free software; you can redistribute it and/or modify
4
 
# it under the terms of the GNU General Public License as published by
5
 
# the Free Software Foundation; either version 2 of the License, or
6
 
# (at your option) any later version.
7
 
#
8
 
# This program is distributed in the hope that it will be useful,
9
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
# GNU General Public License for more details.
12
 
#
13
 
# You should have received a copy of the GNU General Public License
14
 
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
 
#
17
 
 
18
 
"""Tests of the 'bzr alias' command."""
19
 
 
20
 
from bzrlib import (
21
 
    config,
22
 
    tests,
23
 
    )
24
 
 
25
 
 
26
 
class TestAlias(tests.TestCaseWithTransport):
27
 
 
28
 
    def test_list_alias_with_none(self):
29
 
        """Calling alias with no parameters lists existing aliases."""
30
 
        out, err = self.run_bzr('alias')
31
 
        self.assertEquals('', out)
32
 
 
33
 
    def test_list_unknown_alias(self):
34
 
        out, err = self.run_bzr('alias commit')
35
 
        self.assertEquals('bzr alias: commit: not found\n', out)
36
 
 
37
 
    def test_add_alias_outputs_nothing(self):
38
 
        out, err = self.run_bzr('alias commit="commit --strict"')
39
 
        self.assertEquals('', out)
40
 
 
41
 
    def test_add_alias_visible(self):
42
 
        """Adding an alias makes it ..."""
43
 
        self.run_bzr('alias commit="commit --strict"')
44
 
        out, err = self.run_bzr('alias commit')
45
 
        self.assertEquals('bzr alias commit="commit --strict"\n', out)
46
 
 
47
 
    def test_unicode_alias(self):
48
 
        """Unicode aliases should work (Bug #529930)"""
49
 
        file_name = u'foo\xb6'
50
 
 
51
 
        tree = self.make_branch_and_tree('.')
52
 
        self.build_tree([file_name])
53
 
        tree.add(file_name)
54
 
        tree.commit('added')
55
 
 
56
 
        config.GlobalConfig.from_string(
57
 
            u'[ALIASES]\nust=st %s\n' % (file_name,), save=True)
58
 
 
59
 
        out, err = self.run_bzr('ust')
60
 
        self.assertEquals(err, '')
61
 
        self.assertEquals(out, '')
62
 
 
63
 
    def test_alias_listing_alphabetical(self):
64
 
        self.run_bzr('alias commit="commit --strict"')
65
 
        self.run_bzr('alias ll="log --short"')
66
 
        self.run_bzr('alias add="add -q"')
67
 
 
68
 
        out, err = self.run_bzr('alias')
69
 
        self.assertEquals(
70
 
            'bzr alias add="add -q"\n'
71
 
            'bzr alias commit="commit --strict"\n'
72
 
            'bzr alias ll="log --short"\n',
73
 
            out)
74
 
 
75
 
    def test_remove_unknown_alias(self):
76
 
        out, err = self.run_bzr('alias --remove fooix', retcode=3)
77
 
        self.assertEquals('bzr: ERROR: The alias "fooix" does not exist.\n',
78
 
                          err)
79
 
 
80
 
    def test_remove_known_alias(self):
81
 
        self.run_bzr('alias commit="commit --strict"')
82
 
        out, err = self.run_bzr('alias commit')
83
 
        self.assertEquals('bzr alias commit="commit --strict"\n', out)
84
 
        # No output when removing an existing alias.
85
 
        out, err = self.run_bzr('alias --remove commit')
86
 
        self.assertEquals('', out)
87
 
        # Now its not.
88
 
        out, err = self.run_bzr('alias commit')
89
 
        self.assertEquals("bzr alias: commit: not found\n", out)