13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
"""Tests of the 'bzr add' command."""
22
from bzrlib import osutils
23
from bzrlib.tests import (
25
split_suite_by_condition,
22
29
from bzrlib.tests.blackbox import ExternalBase
23
30
from bzrlib.tests.test_win32utils import NeedsGlobExpansionFeature
33
def load_tests(standard_tests, module, loader):
34
"""Parameterize tests for view-aware vs not."""
35
to_adapt, result = split_suite_by_condition(
36
standard_tests, condition_isinstance(TestAdd))
38
('pre-views', {'branch_tree_format': 'pack-0.92'}),
39
('view-aware', {'branch_tree_format': 'development6-rich-root'}),
41
return multiply_tests(to_adapt, scenarios, result)
26
44
class TestAdd(ExternalBase):
46
def make_branch_and_tree(self, dir):
47
return ExternalBase.make_branch_and_tree(self, dir,
48
format=self.branch_tree_format)
28
50
def test_add_reports(self):
29
51
"""add command prints the names of added files."""
30
52
tree = self.make_branch_and_tree('.')
207
229
self.build_tree([u'\u1234A', u'\u1235A', u'\u1235AA', 'cc'])
208
230
self.run_bzr(['add', u'\u1234?', u'\u1235*'])
209
231
self.assertEquals(self.run_bzr('unknowns')[0], 'cc\n')
233
def test_add_via_symlink(self):
234
self.requireFeature(SymlinkFeature)
235
self.make_branch_and_tree('source')
236
self.build_tree(['source/top.txt'])
237
os.symlink('source', 'link')
238
out = self.run_bzr(['add', 'link/top.txt'])[0]
239
self.assertEquals(out, 'adding top.txt\n')
241
def test_add_symlink_to_abspath(self):
242
self.requireFeature(SymlinkFeature)
243
self.make_branch_and_tree('tree')
244
os.symlink(osutils.abspath('target'), 'tree/link')
245
out = self.run_bzr(['add', 'tree/link'])[0]
246
self.assertEquals(out, 'adding link\n')