~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_ignores.py

  • Committer: Robert Collins
  • Date: 2010-04-08 04:34:03 UTC
  • mfrom: (5138 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5139.
  • Revision ID: robertc@robertcollins.net-20100408043403-56z0d07vdqrx7f3t
Update bugfix for 528114 to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
    def test_parse_empty(self):
51
51
        ignored = ignores.parse_ignore_file(StringIO(''))
52
52
        self.assertEqual(set([]), ignored)
 
53
        
 
54
    def test_parse_non_utf8(self):
 
55
        """Lines with non utf 8 characters should be discarded."""
 
56
        ignored = ignores.parse_ignore_file(StringIO(
 
57
                'utf8filename_a\n'
 
58
                'invalid utf8\x80\n'
 
59
                'utf8filename_b\n'
 
60
                ))
 
61
        self.assertEqual(set([
 
62
                        'utf8filename_a',
 
63
                        'utf8filename_b',
 
64
                       ]), ignored)
53
65
 
54
66
 
55
67
class TestUserIgnores(TestCaseInTempDir):
132
144
    def setUp(self):
133
145
        TestCase.setUp(self)
134
146
 
135
 
        orig = ignores._runtime_ignores
136
 
        def restore():
137
 
            ignores._runtime_ignores = orig
138
 
        self.addCleanup(restore)
139
147
        # For the purposes of these tests, we must have no
140
148
        # runtime ignores
141
 
        ignores._runtime_ignores = set()
 
149
        self.overrideAttr(ignores, '_runtime_ignores', set())
142
150
 
143
151
    def test_add(self):
144
152
        """Test that we can add an entry to the list."""