~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Merge sftp-leaks into catch-them-all

Show diffs side-by-side

added added

removed removed

Lines of Context:
162
162
        tree = self.make_branch_and_tree('a')
163
163
        self.run_bzr(['ignore', '--directory=a', 'README'])
164
164
        self.check_file_contents('a/.bzrignore', 'README\n')
 
165
 
 
166
    def test_ignored_invalid_pattern(self):
 
167
        """Ensure graceful handling for invalid ignore pattern.
 
168
 
 
169
        Test case for #300062.
 
170
        Invalid pattern should show clear error message.
 
171
        Invalid pattern should not be added to .bzrignore file.
 
172
        """
 
173
        tree = self.make_branch_and_tree('.')
 
174
        out, err = self.run_bzr(['ignore', 'RE:*.cpp', 'foo', 'RE:['], 3)
 
175
        self.assertEqual(out, '')
 
176
        self.assertContainsRe(err,
 
177
            'Invalid ignore pattern.*RE:\*\.cpp.*RE:\[', re.DOTALL)
 
178
        self.assertNotContainsRe(err, 'foo', re.DOTALL)
 
179
        self.assertFalse(os.path.isfile('.bzrignore'))
 
180