~svn/ubuntu/raring/subversion/ppa

« back to all changes in this revision

Viewing changes to subversion/tests/clients/cmdline/cat_tests.py

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-12-05 01:26:14 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051205012614-qom4xfypgtsqc2xq
Tags: 1.2.3dfsg1-3ubuntu1
Merge with the final Debian release of 1.2.3dfsg1-3, bringing in
fixes to the clean target, better documentation of the libdb4.3
upgrade and build fixes to work with swig1.3_1.3.27.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
#
 
3
#  cat_tests.py:  testing cat cases.
 
4
#
 
5
#  Subversion is a tool for revision control. 
 
6
#  See http://subversion.tigris.org for more information.
 
7
#    
 
8
# ====================================================================
 
9
# Copyright (c) 2000-2004 CollabNet.  All rights reserved.
 
10
#
 
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.
 
16
#
 
17
######################################################################
 
18
 
 
19
# General modules
 
20
import os
 
21
 
 
22
# Our testing module
 
23
import svntest
 
24
 
 
25
 
 
26
# (abbreviation)
 
27
Skip = svntest.testcase.Skip
 
28
XFail = svntest.testcase.XFail
 
29
Item = svntest.wc.StateItem
 
30
 
 
31
 
 
32
######################################################################
 
33
# Tests
 
34
#
 
35
#   Each test must return on success or raise on failure.
 
36
 
 
37
 
 
38
#----------------------------------------------------------------------
 
39
 
 
40
def cat_local_directory(sbox):
 
41
  "cat a local directory"
 
42
  sbox.build()
 
43
 
 
44
  A_path = os.path.join(sbox.wc_dir, 'A')
 
45
  
 
46
  svntest.actions.run_and_verify_svn('No error where one is expected',
 
47
                                     None, svntest.SVNAnyOutput, 'cat', A_path)
 
48
 
 
49
def cat_remote_directory(sbox):
 
50
  "cat a remote directory"
 
51
  sbox.build()
 
52
 
 
53
  A_url = svntest.main.current_repo_url + '/A'
 
54
  
 
55
  svntest.actions.run_and_verify_svn('No error where one is expected',
 
56
                                     None, svntest.SVNAnyOutput, 'cat', A_url)
 
57
 
 
58
def cat_base(sbox):
 
59
  "cat a file at revision BASE"
 
60
  sbox.build()
 
61
 
 
62
  wc_dir = sbox.wc_dir
 
63
 
 
64
  mu_path = os.path.join(wc_dir, 'A', 'mu')
 
65
  svntest.main.file_append(mu_path, 'Appended text')
 
66
  
 
67
  outlines, errlines = svntest.main.run_svn(0, 'cat', mu_path)
 
68
 
 
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]))
 
74
 
 
75
def cat_nonexistant_file(sbox):
 
76
  "cat a nonexistant file"
 
77
  sbox.build()
 
78
 
 
79
  wc_dir = sbox.wc_dir
 
80
 
 
81
  bogus_path = os.path.join(wc_dir, 'A', 'bogus')
 
82
 
 
83
  svntest.actions.run_and_verify_svn('No error where one is expected',
 
84
                                     None, svntest.SVNAnyOutput, 'cat',
 
85
                                     bogus_path)
 
86
 
 
87
########################################################################
 
88
# Run the tests
 
89
 
 
90
 
 
91
# list all tests here, starting with None:
 
92
test_list = [ None,
 
93
              cat_local_directory,
 
94
              cat_remote_directory,
 
95
              cat_base,
 
96
              cat_nonexistant_file
 
97
             ]
 
98
 
 
99
if __name__ == '__main__':
 
100
  svntest.main.run_tests(test_list)
 
101
  # NOTREACHED
 
102
 
 
103
 
 
104
### End of file.