gitstats: Finished the branch testcases, but no test for -r switch yet
[git-stats.git] / src / t / t8100-stats.sh
blob35fdc413703b55690cc7fa9c2ee65b661b667bfc
1 #!/bin/sh
3 # Copyright (c) 2008 Sverre Rabbelier
6 test_description='stats tests (basics)
8 This test verifies that the basic stats commands work as expected.'
10 ORIG_PATH=$PWD
12 . ./test-lib.sh
15 ###########
16 # Setup
17 ###########
20 test_expect_success pre-clean '
21 rm -fr "/tmp/freshrepo" || {
22 trap - exit
23 echo >&5 "FATAL: Cannot clean the fresh repo"
24 exit 1
28 test_expect_success setup '
29 ../../scripts/setupRepo.py
30 cd /tmp/freshrepo
31 PATH=../:$PATH
32 test_must_fail stats.py
35 test_expect_success 'Verify that the expected tree was created' '
36 test `git rev-parse HEAD` = "72224f7dd1549afc56a33851afa32d70144ced4b"
40 ###########
41 # Author tests
42 ###########
46 echo "notes.txt = 3: +3 -0"
47 echo "content.txt = 23: +23 -1"
48 } > expected
50 test_expect_success 'Verify that author filters the result properly' '
51 stats.py author -d "author@example.com" > actual
52 test_cmp expected actual
56 echo "content.txt = 2: +2 -0"
57 } > expected
59 test_expect_success 'Verify that the secondary authors result is filtered properly' '
60 stats.py author -d "roh.tua@example.com" > actual
61 test_cmp expected actual
64 test_expect_failure 'Verify that the output for authors is aggregated properly' '
65 test `stats.py author -a` != ""
68 ###########
69 # Branch tests
70 ###########
73 echo "Matching branches:"
74 echo "pu"
75 } > expected
77 test_expect_success 'Test that the branch filter works as expected' '
78 stats.py branch -c 6f01ab2afb8471d6eee83162ddeabe179e443d59 > actual
79 test_cmp expected actual
83 echo "Matching branches:"
84 echo "maint"
85 echo "master"
86 } > expected
88 test_expect_success \
89 'Test that the branch filter works when multiple branches match' \
91 stats.py branch -c c0e49264fd921d2a62f90556340e371e719b45cc > actual
92 test_cmp expected actual
95 test_expect_failure 'Test that there is a test for the -r switch' '
99 ###########
100 # Teardown
101 ###########
104 test_expect_success 'Teardown' '
105 cd $ORIG_PATH
108 test_done