-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest04.sh
77 lines (58 loc) · 1.31 KB
/
test04.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/dash
# if .girt directory exist already, remove it for testing
if test -d ".girt/"
then
rm -r ".girt/"
fi
failed=0
###testing girt-log###
echo ""
echo "<<<<<<<<<<<<<<<START>>>>>>>>>>>>>>>"
echo ""
# error - calling girt-log before init - exit 1
sh girt-log
test $? -eq 1 || failed=1
sh girt-init
# no commit yet - print nothing and exit 0
sh girt-log
test $? -eq 0 || failed=1
# with arguments - output usage - exit 1
sh girt-log a b
test $? -eq 1 || failed=1
#creating files
seq 1 10 >> a
seq 1 10 >> b
seq 1 10 >> c
# add and commit the files
sh girt-add a b c
sh girt-commit -m "commit-0 with add and commit"
# change the files - add and commit with commit -a
seq 11 20 >> b
seq 30 40 >> c
sh girt-commit -a -m "commit-1 with with commit -a"
#nothing to commit
sh girt-commit -m "commit-2"
#remove a file and add and commit again
rm a
sh girt-add a
sh girt-commit -m "removed a"
# show the commit numbers with their messages
echo "#########################"
sh girt-log
test $? -eq 0 || failed=1
echo "#########################"
rm -r .girt
rm b c
echo ""
echo "<<<<<<<<<<<<<<<END>>>>>>>>>>>>>>>"
echo ""
if test "$failed" -eq 1
then
echo "***************TEST FAILED***************" 1>&2
echo ""
exit 1
else
echo "***************TEST PASSED***************" 1>&2
echo ""
exit 0
fi