-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·72 lines (57 loc) · 1.81 KB
/
test.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
#! /bin/sh
# Run tests. This script assumes that the current directory is the one in which
# it lives. With no argument, run all tests. With argument "unit" run just the
# unit tests. With argument "int" run just the integration tests.
testcmd='go test -test.v'
if test ! -z $1
then
case $1 in
unit )
testcmd="$testcmd -run='^TestUnit'";;
int )
testcmd="$testcmd -run='^TestInt'";;
* )
echo "first argument must be unit or integration" >&2
exit -1
;;
esac
fi
startDir=`pwd`
. ./setenv.sh
# Build mocks
mkdir -p ${startDir}/src/github.com/goblimey/films/mocks/gomock
dir='github.com/goblimey/films/mocks/gomock'
echo ${dir}
cd ${startDir}/src/$dir
mockgen --package gomock net/http ResponseWriter >mock_response_writer.go
mockgen --package gomock github.com/goblimey/films/retrofit/template Template >mock_template.go
mockgen --package gomock github.com/goblimey/films/repositories/people Repository >mock_people_repository.go
mkdir -p ${startDir}/src/github.com/goblimey/films/mocks/pegomock
dir='github.com/goblimey/films/mocks/pegomock'
echo ${dir}
cd ${startDir}/src/$dir
pegomock generate --package pegomock --output=mock_template.go github.com/goblimey/films/retrofit/template Template
pegomock generate --package pegomock --output=mock_response_writer.go net/http ResponseWriter
# Build
go build github.com/goblimey/films
# Test
dir='github.com/goblimey/films/models/person'
echo ${dir}
cd ${startDir}/src/$dir
${testcmd}
dir='github.com/goblimey/films/models/person/gorpmysql'
echo ${dir}
cd ${startDir}/src/$dir
${testcmd}
dir='github.com/goblimey/films/forms/people'
echo ${dir}
cd ${startDir}/src/$dir
${testcmd}
dir='github.com/goblimey/films/repositories/people'
echo ${dir}
cd ${startDir}/src/$dir
${testcmd}
dir='github.com/goblimey/films/controllers/people'
echo ${dir}
cd ${startDir}/src/$dir
${testcmd}