From 2e11994155f01c1e6886e44af8632c3cbd1adfa0 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 7 Sep 2015 15:40:12 +0200 Subject: [PATCH] hard-code the expected number of entries in the CR for a tighter test. --- tests/run-turn.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/run-turn.sh b/tests/run-turn.sh index 9bfe19ba6..0cee4ce5b 100755 --- a/tests/run-turn.sh +++ b/tests/run-turn.sh @@ -9,9 +9,18 @@ ln -sf ../scripts/config.lua quit() { test -n "$2" && echo $2 +echo "integration tests: FAILED" 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` while [ ! -d $ROOT/.git ]; do ROOT=`dirname $ROOT` @@ -34,11 +43,11 @@ CRFILE=185-zvto.cr for file in $NEWFILES reports/$CRFILE ; do [ -e $file ] || quit 5 "did not create $file" done -grep -q PARTEI reports/$CRFILE || quit 1 "CR did not contain any factions" -grep -q REGION reports/$CRFILE || quit 2 "CR did not contain any regions" -grep -q SCHIFF reports/$CRFILE || quit 3 "CR did not contain any ships" -grep -q BURG reports/$CRFILE || quit 4 "CR did not contain any buildings" -grep -q EINHEIT reports/$CRFILE || quit 5 "CR did not contain any units" -grep -q GEGENSTAENDE reports/$CRFILE || quit 6 "CR did not contain any items" +assert_grep_count reports/$CRFILE '^REGION' 7 +assert_grep_count reports/$CRFILE '^PARTEI' 2 +assert_grep_count reports/$CRFILE '^SCHIFF' 1 +assert_grep_count reports/$CRFILE '^BURG' 1 +assert_grep_count reports/$CRFILE '^EINHEIT' 2 +assert_grep_count reports/$CRFILE '^GEGENSTAENDE' 2 echo "integration tests: PASS" cleanup