forked from github/server
hard-code the expected number of entries in the CR for a tighter test.
This commit is contained in:
parent
bf86b1d66a
commit
2e11994155
|
@ -9,9 +9,18 @@ ln -sf ../scripts/config.lua
|
||||||
|
|
||||||
quit() {
|
quit() {
|
||||||
test -n "$2" && echo $2
|
test -n "$2" && echo $2
|
||||||
|
echo "integration tests: FAILED"
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert_grep_count() {
|
||||||
|
file=$1
|
||||||
|
expr=$2
|
||||||
|
expect=$3
|
||||||
|
count=`grep -cE $expr $file`
|
||||||
|
[ $count -eq $expect ] || quit 1 "expected $expect counts of $expr in $file, got $count"
|
||||||
|
}
|
||||||
|
|
||||||
ROOT=`pwd`
|
ROOT=`pwd`
|
||||||
while [ ! -d $ROOT/.git ]; do
|
while [ ! -d $ROOT/.git ]; do
|
||||||
ROOT=`dirname $ROOT`
|
ROOT=`dirname $ROOT`
|
||||||
|
@ -34,11 +43,11 @@ CRFILE=185-zvto.cr
|
||||||
for file in $NEWFILES reports/$CRFILE ; do
|
for file in $NEWFILES reports/$CRFILE ; do
|
||||||
[ -e $file ] || quit 5 "did not create $file"
|
[ -e $file ] || quit 5 "did not create $file"
|
||||||
done
|
done
|
||||||
grep -q PARTEI reports/$CRFILE || quit 1 "CR did not contain any factions"
|
assert_grep_count reports/$CRFILE '^REGION' 7
|
||||||
grep -q REGION reports/$CRFILE || quit 2 "CR did not contain any regions"
|
assert_grep_count reports/$CRFILE '^PARTEI' 2
|
||||||
grep -q SCHIFF reports/$CRFILE || quit 3 "CR did not contain any ships"
|
assert_grep_count reports/$CRFILE '^SCHIFF' 1
|
||||||
grep -q BURG reports/$CRFILE || quit 4 "CR did not contain any buildings"
|
assert_grep_count reports/$CRFILE '^BURG' 1
|
||||||
grep -q EINHEIT reports/$CRFILE || quit 5 "CR did not contain any units"
|
assert_grep_count reports/$CRFILE '^EINHEIT' 2
|
||||||
grep -q GEGENSTAENDE reports/$CRFILE || quit 6 "CR did not contain any items"
|
assert_grep_count reports/$CRFILE '^GEGENSTAENDE' 2
|
||||||
echo "integration tests: PASS"
|
echo "integration tests: PASS"
|
||||||
cleanup
|
cleanup
|
||||||
|
|
Loading…
Reference in New Issue