~ubuntu-branches/debian/sid/calligraplan/sid

« back to all changes in this revision

Viewing changes to tests/test_messages.sh

  • Committer: Package Import Robot
  • Author(s): Pino Toscano
  • Date: 2018-02-01 18:20:19 UTC
  • Revision ID: package-import@ubuntu.com-20180201182019-1qo7qaim5wejm5k9
Tags: upstream-3.1.0
ImportĀ upstreamĀ versionĀ 3.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
# test_messages:
 
3
# $1: base directory
 
4
 
 
5
if test -z "$1"; then
 
6
    echo "FAIL Called without base directory"
 
7
    exit 1
 
8
fi
 
9
if ! test -d "$1"; then
 
10
    echo "$1 is not a directory"
 
11
    exit 1
 
12
fi
 
13
 
 
14
result=0
 
15
files=0
 
16
errors=0
 
17
 
 
18
# handle whitespace and some other special characters in dir/file names
 
19
while IFS= read -rd $'\0' file; do
 
20
    files=$((files + 1))
 
21
    echo "Testing $files: $file"
 
22
    echo `grep '^potfilename=' "$file"`
 
23
    count=`grep -c '^potfilename=' "$file"`
 
24
    if [[ $count != 1 ]]; then
 
25
        errors=$((errors + 1))
 
26
        echo "FAIL Did not find 'potfilename=' correct number of times"
 
27
        echo "        Found: $count"
 
28
        echo "     Expected: 1"
 
29
        result=2;
 
30
    fi
 
31
    echo "----------------------------------------------------------"
 
32
done < <(find "$1" -name 'Messages.sh' -type f -print0 )
 
33
 
 
34
echo
 
35
echo "Found and tested $files messagefiles, detected $errors errors"
 
36
echo
 
37
echo "----------------------------------------------------------"
 
38
 
 
39
exit $result