Blame


1 0e673013 2019-01-02 stsp #!/bin/sh
2 0e673013 2019-01-02 stsp #
3 0e673013 2019-01-02 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
4 0e673013 2019-01-02 stsp #
5 0e673013 2019-01-02 stsp # Permission to use, copy, modify, and distribute this software for any
6 0e673013 2019-01-02 stsp # purpose with or without fee is hereby granted, provided that the above
7 0e673013 2019-01-02 stsp # copyright notice and this permission notice appear in all copies.
8 0e673013 2019-01-02 stsp #
9 0e673013 2019-01-02 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 0e673013 2019-01-02 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 0e673013 2019-01-02 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 0e673013 2019-01-02 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 0e673013 2019-01-02 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 0e673013 2019-01-02 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 0e673013 2019-01-02 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 0e673013 2019-01-02 stsp
17 0e673013 2019-01-02 stsp . ./common.sh
18 0e673013 2019-01-02 stsp
19 0e673013 2019-01-02 stsp function test_checkout_basic {
20 0e673013 2019-01-02 stsp local testroot=`test_init checkout_basic`
21 0e673013 2019-01-02 stsp
22 0e673013 2019-01-02 stsp echo "A $testroot/wt/alpha" > $testroot/stdout.expected
23 0e673013 2019-01-02 stsp echo "A $testroot/wt/beta" >> $testroot/stdout.expected
24 0e673013 2019-01-02 stsp echo "A $testroot/wt/epsilon/zeta" >> $testroot/stdout.expected
25 0e673013 2019-01-02 stsp echo "A $testroot/wt/gamma/delta" >> $testroot/stdout.expected
26 0e673013 2019-01-02 stsp echo "Now shut up and hack" >> $testroot/stdout.expected
27 0e673013 2019-01-02 stsp
28 0e673013 2019-01-02 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
29 0e673013 2019-01-02 stsp if [ "$?" != "0" ]; then
30 0e673013 2019-01-02 stsp test_done "$testroot" "$?"
31 0e673013 2019-01-02 stsp return 1
32 0e673013 2019-01-02 stsp fi
33 0e673013 2019-01-02 stsp
34 0e673013 2019-01-02 stsp cmp $testroot/stdout.expected $testroot/stdout
35 0e673013 2019-01-02 stsp if [ "$?" != "0" ]; then
36 0e673013 2019-01-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
37 0e673013 2019-01-02 stsp test_done "$testroot" "$?"
38 0e673013 2019-01-02 stsp return 1
39 0e673013 2019-01-02 stsp fi
40 0e673013 2019-01-02 stsp
41 0e673013 2019-01-02 stsp echo "alpha" > $testroot/content.expected
42 0e673013 2019-01-02 stsp echo "beta" >> $testroot/content.expected
43 0e673013 2019-01-02 stsp echo "zeta" >> $testroot/content.expected
44 0e673013 2019-01-02 stsp echo "delta" >> $testroot/content.expected
45 0e673013 2019-01-02 stsp cat $testroot/wt/alpha $testroot/wt/beta $testroot/wt/epsilon/zeta \
46 0e673013 2019-01-02 stsp $testroot/wt/gamma/delta > $testroot/content
47 0e673013 2019-01-02 stsp
48 0e673013 2019-01-02 stsp cmp $testroot/content.expected $testroot/content
49 693719bc 2019-01-03 stsp ret="$?"
50 693719bc 2019-01-03 stsp if [ "$ret" != "0" ]; then
51 0e673013 2019-01-02 stsp diff -u $testroot/content.expected $testroot/content
52 0e673013 2019-01-02 stsp fi
53 693719bc 2019-01-03 stsp test_done "$testroot" "$ret"
54 0e673013 2019-01-02 stsp }
55 0e673013 2019-01-02 stsp
56 0e673013 2019-01-02 stsp run_test test_checkout_basic