104
104
# Create an empty file
105
105
ignores._set_user_ignores([])
107
in_patterns = ['foo/', 'bar/']
107
in_patterns = ['foo/', 'bar/', 'baz\\']
108
108
added = ignores.add_unique_user_ignores(in_patterns)
109
out_patterns = [ x.rstrip('/') for x in in_patterns ]
109
out_patterns = [ x.rstrip('/\\') for x in in_patterns ]
110
110
self.assertEqual(out_patterns, added)
111
111
self.assertEqual(set(out_patterns), ignores.get_user_ignores())
113
113
def test_add_unique(self):
114
114
"""Test that adding will not duplicate ignores"""
115
ignores._set_user_ignores(['foo', './bar', u'b\xe5z', 'dir1/'])
115
ignores._set_user_ignores(
116
['foo', './bar', u'b\xe5z', 'dir1/', 'dir3\\'])
117
118
added = ignores.add_unique_user_ignores(
118
['xxx', './bar', 'xxx', 'dir1/', 'dir2/'])
119
['xxx', './bar', 'xxx', 'dir1/', 'dir2/', 'dir3\\'])
119
120
self.assertEqual(['xxx', 'dir2'], added)
120
121
self.assertEqual(set(['foo', './bar', u'b\xe5z',
121
'xxx', 'dir1', 'dir2']),
122
'xxx', 'dir1', 'dir2', 'dir3']),
122
123
ignores.get_user_ignores())