/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_ls.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
"""External tests of 'bzr ls'"""
18
18
 
36
36
                                 ('a', 'hello\n'),
37
37
                                 ])
38
38
 
39
 
    def ls_equals(self, value, args=None):
 
39
    def ls_equals(self, value, args=None, recursive=True):
40
40
        command = 'ls'
41
41
        if args is not None:
42
42
            command += ' ' + args
 
43
        if recursive:
 
44
            command += ' -R'
43
45
        out, err = self.run_bzr(command)
44
46
        self.assertEqual('', err)
45
47
        self.assertEqualDiff(value, out)
108
110
                       'a\0a-id\0'
109
111
                       'subdir\0subdir-id\0', '--show-ids --null')
110
112
 
111
 
    def test_ls_recursive(self):
 
113
    def test_ls_no_recursive(self):
112
114
        self.build_tree(['subdir/', 'subdir/b'])
113
115
        self.wt.add(['a', 'subdir/', 'subdir/b', '.bzrignore'])
114
116
 
115
117
        self.ls_equals('.bzrignore\n'
116
118
                       'a\n'
117
119
                       'subdir/\n'
118
 
                       , '--non-recursive')
 
120
                       , recursive=False)
119
121
 
120
122
        self.ls_equals('V        .bzrignore\n'
121
123
                       'V        a\n'
122
124
                       'V        subdir/\n'
123
 
                       , '--verbose --non-recursive')
 
125
                       , '--verbose', recursive=False)
124
126
 
125
127
        # Check what happens in a sub-directory
126
128
        os.chdir('subdir')
140
142
        self.ls_equals('.bzrignore\n'
141
143
                       'a\n'
142
144
                       'subdir/\n'
143
 
                       , '--from-root --non-recursive')
 
145
                       , '--from-root', recursive=False)
144
146
 
145
147
    def test_ls_path(self):
146
148
        """If a path is specified, files are listed with that prefix"""
164
166
                       'V        ../subdir/\n'
165
167
                       'V        ../subdir/b\n' ,
166
168
                       '.. --verbose')
167
 
        self.run_bzr_error('cannot specify both --from-root and PATH',
 
169
        self.run_bzr_error(['cannot specify both --from-root and PATH'],
168
170
                           'ls --from-root ..')
169
171
 
170
172
    def test_ls_revision(self):
233
235
                       '--kind=directory')
234
236
        self.ls_equals('',
235
237
                       '--kind=symlink')
236
 
        self.run_bzr_error('invalid kind specified', 'ls --kind=pile')
 
238
        self.run_bzr_error(['invalid kind specified'], 'ls --kind=pile')
 
239
 
 
240
    def test_ls_path_nonrecursive(self):
 
241
        self.ls_equals('%s/.bzrignore\n'
 
242
                       '%s/a\n'
 
243
                       % (self.test_dir, self.test_dir),
 
244
                       self.test_dir, recursive=False)