/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_commands.py

  • Committer: Aaron Bentley
  • Date: 2006-12-22 02:00:06 UTC
  • mfrom: (2212 +trunk)
  • mto: (2255.6.1 dirstate)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: aaron.bentley@utoronto.ca-20061222020006-8h1kgh4iax3c90ju
merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
 
17
from cStringIO import StringIO
17
18
import errno
18
19
 
19
20
from bzrlib import (
20
21
    commands,
 
22
    config,
21
23
    errors,
22
24
    )
23
25
from bzrlib.commands import display_command
55
57
        self.assertRaises(errors.BzrCommandError,
56
58
                          commands.run_bzr, ['log', u'--option\xb5'])
57
59
 
 
60
 
 
61
class TestGetAlias(TestCase):
 
62
 
 
63
    def _get_config(self, config_text):
 
64
        my_config = config.GlobalConfig()
 
65
        config_file = StringIO(config_text.encode('utf-8'))
 
66
        my_config._parser = my_config._get_parser(file=config_file)
 
67
        return my_config
 
68
 
 
69
    def test_simple(self):
 
70
        my_config = self._get_config("[ALIASES]\n"
 
71
            "diff=diff -r -2..-1\n")
 
72
        self.assertEqual([u'diff', u'-r', u'-2..-1'],
 
73
            commands.get_alias("diff", config=my_config))
 
74
 
 
75
    def test_single_quotes(self):
 
76
        my_config = self._get_config("[ALIASES]\n"
 
77
            "diff=diff -r -2..-1 --diff-options "
 
78
            "'--strip-trailing-cr -wp'\n")
 
79
        self.assertEqual([u'diff', u'-r', u'-2..-1', u'--diff-options',
 
80
                          u'--strip-trailing-cr -wp'],
 
81
                          commands.get_alias("diff", config=my_config))
 
82
 
 
83
    def test_double_quotes(self):
 
84
        my_config = self._get_config("[ALIASES]\n"
 
85
            "diff=diff -r -2..-1 --diff-options "
 
86
            "\"--strip-trailing-cr -wp\"\n")
 
87
        self.assertEqual([u'diff', u'-r', u'-2..-1', u'--diff-options',
 
88
                          u'--strip-trailing-cr -wp'],
 
89
                          commands.get_alias("diff", config=my_config))
 
90
 
 
91
    def test_unicode(self):
 
92
        my_config = self._get_config("[ALIASES]\n"
 
93
            u"iam=whoami 'Erik B\u00e5gfors <erik@bagfors.nu>'\n")
 
94
        self.assertEqual([u'whoami', u'Erik B\u00e5gfors <erik@bagfors.nu>'],
 
95
                          commands.get_alias("iam", config=my_config))