3
# Simple shell-based tests for bzr.
5
# This is meant to exercise the external behaviour, command line
6
# parsing and similar things and compliment the inwardly-turned
7
# testing done by doctest.
9
# This must already exist and be in the right place
10
if ! [ -d bzr-test.tmp ]
12
echo "please create directory bzr-test.tmp"
16
echo "testing `which bzr`"
17
bzr --version | head -n 1
23
# save it for real errors
31
echo "tests failed, look in bzr-test.log" >&3; exit 2;
42
# some information commands
46
[ $(bzr help commands | wc -l) -gt 20 ]
48
# invalid commands are detected
51
# TODO: test unicode user names
55
# some experiments with renames
57
echo "hello world" > test.txt
60
# should be the only unknown file
61
[ "`bzr unknowns`" = test.txt ]
63
bzr status --all > status.tmp
64
! diff -u - status.tmp <<EOF
70
bzr st --all | diff -u - status.tmp
72
# can't rename unversioned files; use the regular unix rename command
73
! bzr rename test.txt new-test.txt
75
# ok, so now add it and see what happens
77
[ -z "`bzr unknowns`" ]
79
# after adding even before committing you can rename files
80
bzr rename test.txt newname.txt
81
[ "`bzr status`" = "A newname.txt" ]
84
bzr commit -m "add first revision"
87
# now more complicated renames
89
! bzr rename newname.txt sub1
90
! bzr rename newname.txt sub1/foo.txt
92
! bzr rename newname.txt sub1
94
bzr rename newname.txt sub1/foo.txt
98
bzr rename sub1/foo.txt newname.txt
101
bzr rename newname.txt sub1/foo.txt
102
bzr rename sub1/foo.txt sub1/bar.txt
107
bzr rename bar.txt sub2/bar.txt
109
bzr rename bar.txt ../../bar.txt
112
bzr commit -m "more renames"
115
# now try pulling that file back out, checking it was stored properly
116
[ "`bzr cat -r 1 newname.txt`" = "hello world" ]
118
! bzr rename sub1 sub1/knotted-up
124
# now test hardlinked branches in subdirectories
126
[ -d branch2 ] && rm -rf branch2
127
cp -al branch1 branch2
133
echo "added in branch2" > new-in-2.txt
135
bzr commit -m "add file to branch 2 only"
145
echo "tests completed ok" >&3
b'\\ No newline at end of file'