/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Robert Collins
  • Date: 2009-05-23 20:57:12 UTC
  • mfrom: (4371 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4441.
  • Revision ID: robertc@robertcollins.net-20090523205712-lcwbfqk6vwavinuv
MergeĀ .dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
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
16
16
#
17
17
 
18
18
"""Tests of the 'bzr add' command."""
19
19
 
20
20
import os
21
21
 
 
22
from bzrlib import osutils
 
23
from bzrlib.tests import (
 
24
    condition_isinstance,
 
25
    split_suite_by_condition,
 
26
    multiply_tests,
 
27
    SymlinkFeature
 
28
    )
22
29
from bzrlib.tests.blackbox import ExternalBase
23
30
from bzrlib.tests.test_win32utils import NeedsGlobExpansionFeature
24
31
 
25
32
 
 
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))
 
37
    scenarios = [
 
38
        ('pre-views', {'branch_tree_format': 'pack-0.92'}),
 
39
        ('view-aware', {'branch_tree_format': 'development6-rich-root'}),
 
40
        ]
 
41
    return multiply_tests(to_adapt, scenarios, result)
 
42
 
 
43
 
26
44
class TestAdd(ExternalBase):
27
45
 
 
46
    def make_branch_and_tree(self, dir):
 
47
        return ExternalBase.make_branch_and_tree(self, dir,
 
48
            format=self.branch_tree_format)
 
49
 
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')
 
232
 
 
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')
 
240
 
 
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')