~ubuntu-branches/debian/lenny/bzr/lenny

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_ignores.py

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-08-22 20:06:37 UTC
  • mfrom: (3.1.63 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080822200637-kxobfsnjlzojhqra
Tags: 1.5-1.1
* Non-maintainer upload.
* Apply patch from upstream VCS to fix FTBFS in tools/rst2html.py
  with older docutils. Thanks to Olivier Tétard for digging it
  up.
  Closes: #494246.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 by Canonical Ltd
 
1
# Copyright (C) 2006 Canonical Ltd
2
2
#
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
99
99
        self.assertEqual(patterns, added)
100
100
        self.assertEqual(set(patterns), ignores.get_user_ignores())
101
101
 
 
102
    def test_add_directory(self):
 
103
        """Test that adding a directory will strip any trailing slash"""
 
104
        # Create an empty file
 
105
        ignores._set_user_ignores([])
 
106
 
 
107
        in_patterns = ['foo/', 'bar/', 'baz\\']
 
108
        added = ignores.add_unique_user_ignores(in_patterns)
 
109
        out_patterns = [ x.rstrip('/\\') for x in in_patterns ]
 
110
        self.assertEqual(out_patterns, added)
 
111
        self.assertEqual(set(out_patterns), ignores.get_user_ignores())
 
112
 
102
113
    def test_add_unique(self):
103
114
        """Test that adding will not duplicate ignores"""
104
 
        ignores._set_user_ignores(['foo', './bar', u'b\xe5z'])
 
115
        ignores._set_user_ignores(
 
116
            ['foo', './bar', u'b\xe5z', 'dir1/', 'dir3\\'])
105
117
 
106
 
        added = ignores.add_unique_user_ignores(['xxx', './bar', 'xxx'])
107
 
        self.assertEqual(['xxx'], added)
108
 
        self.assertEqual(set(['foo', './bar', u'b\xe5z', 'xxx']),
 
118
        added = ignores.add_unique_user_ignores(
 
119
            ['xxx', './bar', 'xxx', 'dir1/', 'dir2/', 'dir3\\'])
 
120
        self.assertEqual(['xxx', 'dir2'], added)
 
121
        self.assertEqual(set(['foo', './bar', u'b\xe5z', 
 
122
                              'xxx', 'dir1', 'dir2', 'dir3']),
109
123
                         ignores.get_user_ignores())
110
124
 
111
125