Skip to content

Commit

Permalink
Merge pull request #2 from OpenSemanticWorld/master
Browse files Browse the repository at this point in the history
fix run multiple tests
  • Loading branch information
simontaurus authored Dec 13, 2023
2 parents 4892875 + b3bdadf commit 4064a52
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions .test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,24 @@ return_code=0
for f in $(find /usr/local/apache2/htdocs -name '.htaccess')
do
echo "Processing file $f"
res=$(grep "##TESTv1" "$f")
if [ "$res" == "" ]; then
echo "No tests found"
continue
fi
#eval "parts=($IN)"
declare -a "parts=($( echo "$res" | sed 's/[][`~!@#$%^&*();<>,?\|{}=+]/\\&/g' ))"
grep "##TESTv1" "$f" | while read -r line ; do
#eval "parts=($IN)"
declare -a "parts=($( echo "$line" | sed 's/[][`~!@#$%^&*();<>,?\|{}=+]/\\&/g' ))"

curl="curl -sL -o /dev/null -w "%{url_effective}" --resolve www.w3id.org:80:127.0.0.1 www.w3id.org:80"
curl_cmd="${parts[1]}"
expected_result="${parts[2]}"
echo "TEST '$curl_cmd' => '$expected_result'"

cmd="$curl$curl_cmd"
result=$(bash -c "$cmd")
if [ "$result" == "$expected_result" ]; then
echo "SUCCESS: Result is '$result'"
else
echo "ERROR : Result is '$result'"
return_code=1
fi
curl="curl -sL -o /dev/null -w "%{url_effective}" --resolve www.w3id.org:80:127.0.0.1 www.w3id.org:80"
curl_cmd="${parts[1]}"
expected_result="${parts[2]}"
echo "TEST '$curl_cmd' => '$expected_result'"

cmd="$curl$curl_cmd"
result=$(bash -c "$cmd")
if [ "$result" == "$expected_result" ]; then
echo "SUCCESS: Result is '$result'"
else
echo "ERROR : Result is '$result'"
return_code=1
fi
done

done
exit $return_code

0 comments on commit 4064a52

Please sign in to comment.