3 # Copyright (c) 2008 Sverre Rabbelier
6 test_description
='stats tests (basics)
8 This test verifies that the basic stats commands work as expected.'
20 test_expect_success pre-clean
'
21 rm -fr "/tmp/freshrepo" || {
23 echo >&5 "FATAL: Cannot clean the fresh repo"
28 test_expect_success setup
'
29 ../../scripts/setupRepo.py
32 test_must_fail stats.py
35 test_expect_success
'Verify that the expected tree was created' '
36 test `git rev-parse HEAD` = "72224f7dd1549afc56a33851afa32d70144ced4b"
46 echo "notes.txt = 3: +3 -0"
47 echo "content.txt = 23: +23 -1"
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"
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
67 test_expect_failure
'Verify that the output for authors is aggregated properly' '
68 `stats.py author -a` > actual
69 test_must_fail test_cmp expected actual
77 echo "Matching branches:"
81 test_expect_success
'Test that the branch filter works as expected' '
82 stats.py branch -c 6f01ab2afb8471d6eee83162ddeabe179e443d59 > actual
83 test_cmp expected actual
87 echo "Matching branches:"
93 'Test that the branch filter works when multiple branches match' \
95 stats.py branch -c c0e49264fd921d2a62f90556340e371e719b45cc > actual
96 test_cmp expected actual
99 test_expect_failure
'Test that there is a test for the branch -r switch' '
109 echo "commit e76ad031836912c01da47ab93d3c21676763267e
110 Author: A U Thor <author@example.com>
111 Date: Thu May 26 23:30:00 2005 +0000
117 commit e8fa5fed0d1823c1e3e120579b03343aecf26ab6
118 Author: A U Thor <author@example.com>
119 Date: Thu May 26 23:30:00 2005 +0000
125 commit bd952062891010102e3632aecd0f738a35c1fca3
126 Author: A U Thor <author@example.com>
127 Date: Thu May 26 23:30:00 2005 +0000
134 test_expect_success
'Test that commit --contains option filters properly' '
135 stats.py commit -t notes.txt > actual
136 test_cmp expected actual
139 test_expect_failure
'Test that there is a test for the commit -r switch' '
143 echo "commit bc6d646fd15953cdb514d14458f013a1fc05153c
144 Author: A U Thor <author@example.com>
145 Date: Thu May 26 23:30:00 2005 +0000
152 test_expect_success
'Test that the --log option filters properly' '
153 stats.py commit --log-contains=Initial > actual
154 test_cmp expected actual
157 test_expect_failure
'Test that the --diff option filters properly' '
158 stats.py commit --diff-contains=Initial > actual
159 test_cmp expected actual
168 test_expect_success
'Teardown' '