3
# cat_tests.py: testing cat cases.
5
# Subversion is a tool for revision control.
6
# See http://subversion.tigris.org for more information.
8
# ====================================================================
9
# Copyright (c) 2000-2004 CollabNet. All rights reserved.
11
# This software is licensed as described in the file COPYING, which
12
# you should have received as part of this distribution. The terms
13
# are also available at http://subversion.tigris.org/license-1.html.
14
# If newer versions of this license are posted there, you may use a
15
# newer version instead, at your option.
17
######################################################################
27
Skip = svntest.testcase.Skip
28
XFail = svntest.testcase.XFail
29
Item = svntest.wc.StateItem
32
######################################################################
35
# Each test must return on success or raise on failure.
38
#----------------------------------------------------------------------
40
def cat_local_directory(sbox):
41
"cat a local directory"
44
A_path = os.path.join(sbox.wc_dir, 'A')
46
svntest.actions.run_and_verify_svn('No error where one is expected',
47
None, svntest.SVNAnyOutput, 'cat', A_path)
49
def cat_remote_directory(sbox):
50
"cat a remote directory"
53
A_url = svntest.main.current_repo_url + '/A'
55
svntest.actions.run_and_verify_svn('No error where one is expected',
56
None, svntest.SVNAnyOutput, 'cat', A_url)
59
"cat a file at revision BASE"
64
mu_path = os.path.join(wc_dir, 'A', 'mu')
65
svntest.main.file_append(mu_path, 'Appended text')
67
outlines, errlines = svntest.main.run_svn(0, 'cat', mu_path)
69
# Verify the expected output
70
expected_output = svntest.main.greek_state.desc['A/mu'].contents
71
if len(outlines) != 1 or outlines[0] != expected_output:
72
raise svntest.Failure ('Cat failed: expected "%s", but received "%s"' % \
73
(expected_output, outlines[0]))
75
def cat_nonexistant_file(sbox):
76
"cat a nonexistant file"
81
bogus_path = os.path.join(wc_dir, 'A', 'bogus')
83
svntest.actions.run_and_verify_svn('No error where one is expected',
84
None, svntest.SVNAnyOutput, 'cat',
87
########################################################################
91
# list all tests here, starting with None:
99
if __name__ == '__main__':
100
svntest.main.run_tests(test_list)