File indexing completed on 2024-04-21 15:53:46
0001 #! /bin/sh 0002 # test_messages: 0003 # $1: base directory 0004 0005 if test -z "$1"; then 0006 echo "FAIL Called without base directory" 0007 exit 1 0008 fi 0009 if ! test -d "$1"; then 0010 echo "$1 is not a directory" 0011 exit 1 0012 fi 0013 0014 result=0 0015 files=0 0016 errors=0 0017 0018 # handle whitespace and some other special characters in dir/file names 0019 while IFS= read -rd $'\0' file; do 0020 files=$((files + 1)) 0021 echo "Testing $files: $file" 0022 echo `grep '^potfilename=' "$file"` 0023 count=`grep -c '^potfilename=' "$file"` 0024 if [[ $count != 1 ]]; then 0025 errors=$((errors + 1)) 0026 echo "FAIL Did not find 'potfilename=' correct number of times" 0027 echo " Found: $count" 0028 echo " Expected: 1" 0029 result=2; 0030 fi 0031 echo "----------------------------------------------------------" 0032 done < <(find "$1" -name 'Messages.sh' -type f -print0 ) 0033 0034 echo 0035 echo "Found and tested $files messagefiles, detected $errors errors" 0036 echo 0037 echo "----------------------------------------------------------" 0038 0039 exit $result