3 4e0a20a4 2020-03-23 tracey # Copyright (c) 2020 Tracey Emery <tracey@openbsd.org>
5 4e0a20a4 2020-03-23 tracey # Permission to use, copy, modify, and distribute this software for any
6 4e0a20a4 2020-03-23 tracey # purpose with or without fee is hereby granted, provided that the above
7 4e0a20a4 2020-03-23 tracey # copyright notice and this permission notice appear in all copies.
9 4e0a20a4 2020-03-23 tracey # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 4e0a20a4 2020-03-23 tracey # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 4e0a20a4 2020-03-23 tracey # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 4e0a20a4 2020-03-23 tracey # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 4e0a20a4 2020-03-23 tracey # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 4e0a20a4 2020-03-23 tracey # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 4e0a20a4 2020-03-23 tracey # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 4e0a20a4 2020-03-23 tracey . ./common.sh
19 4e0a20a4 2020-03-23 tracey function test_tree_basic {
20 4e0a20a4 2020-03-23 tracey local testroot=`test_init tree_basic`
22 4e0a20a4 2020-03-23 tracey got checkout $testroot/repo $testroot/wt > /dev/null
24 4e0a20a4 2020-03-23 tracey echo "new file" > $testroot/wt/foo
26 4e0a20a4 2020-03-23 tracey (cd $testroot/wt && got add foo > /dev/null)
27 810a850e 2020-03-23 tracey (cd $testroot/wt && got commit -m "add foo" foo > /dev/null)
29 4e0a20a4 2020-03-23 tracey echo 'alpha' > $testroot/stdout.expected
30 4e0a20a4 2020-03-23 tracey echo 'beta' >> $testroot/stdout.expected
31 4e0a20a4 2020-03-23 tracey echo 'epsilon/' >> $testroot/stdout.expected
32 4e0a20a4 2020-03-23 tracey echo 'foo' >> $testroot/stdout.expected
33 4e0a20a4 2020-03-23 tracey echo 'gamma/' >> $testroot/stdout.expected
35 4e0a20a4 2020-03-23 tracey (cd $testroot/wt && got tree > $testroot/stdout)
37 4e0a20a4 2020-03-23 tracey cmp -s $testroot/stdout.expected $testroot/stdout
39 4e0a20a4 2020-03-23 tracey if [ "$ret" != "0" ]; then
40 4e0a20a4 2020-03-23 tracey diff -u $testroot/stdout.expected $testroot/stdout
43 4e0a20a4 2020-03-23 tracey test_done "$testroot" "$ret"
46 4e0a20a4 2020-03-23 tracey function test_tree_branch {
47 4e0a20a4 2020-03-23 tracey local testroot=`test_init tree_branch`
49 4e0a20a4 2020-03-23 tracey got checkout $testroot/repo $testroot/wt > /dev/null
51 4e0a20a4 2020-03-23 tracey if [ "$ret" != "0" ]; then
52 4e0a20a4 2020-03-23 tracey test_done "$testroot" "$ret"
56 4e0a20a4 2020-03-23 tracey (cd $testroot/wt && got br foo > $testroot/stdout)
58 4e0a20a4 2020-03-23 tracey echo "new file" > $testroot/wt/foo
60 4e0a20a4 2020-03-23 tracey (cd $testroot/wt && got add foo > /dev/null)
61 810a850e 2020-03-23 tracey (cd $testroot/wt && got commit -m "add foo" foo > /dev/null)
63 4e0a20a4 2020-03-23 tracey echo 'alpha' > $testroot/stdout.expected
64 4e0a20a4 2020-03-23 tracey echo 'beta' >> $testroot/stdout.expected
65 4e0a20a4 2020-03-23 tracey echo 'epsilon/' >> $testroot/stdout.expected
66 4e0a20a4 2020-03-23 tracey echo 'foo' >> $testroot/stdout.expected
67 4e0a20a4 2020-03-23 tracey echo 'gamma/' >> $testroot/stdout.expected
69 4e0a20a4 2020-03-23 tracey (cd $testroot/wt && got tree > $testroot/stdout)
71 4e0a20a4 2020-03-23 tracey cmp -s $testroot/stdout.expected $testroot/stdout
73 4e0a20a4 2020-03-23 tracey if [ "$ret" != "0" ]; then
74 4e0a20a4 2020-03-23 tracey diff -u $testroot/stdout.expected $testroot/stdout
77 4e0a20a4 2020-03-23 tracey test_done "$testroot" "$ret"
80 4e0a20a4 2020-03-23 tracey run_test test_tree_basic
81 4e0a20a4 2020-03-23 tracey run_test test_tree_branch