...
 
Commits (3)
......@@ -410,7 +410,7 @@ Section 8 -- Interpretation.
Creative Commons is not a party to its public
licenses. Notwithstanding, Creative Commons may elect to apply one of
its public licenses to material it publishes and in those instances
will be considered the ƒÇ·Licensor.ƒÇÑ The text of the Creative Commons
will be considered the "Licensor". The text of the Creative Commons
public licenses is dedicated to the public domain under the CC0 Public
Domain Dedication. Except for the limited purpose of indicating that
material is shared under a Creative Commons public license or as
......
......@@ -4,6 +4,9 @@
OLDPWD=$(pwd)
dir="$(dirname "$(readlink -f "$0")")/.."
RV=0
FAILED=""
scripts="$1"
at_exit() {
if ! cd "$OLDPWD" ; then
......@@ -13,19 +16,58 @@ at_exit() {
if test "$RV" = "0" ; then
echo "Info: at_exit(): All test sucessful."
else
echo "Warning: at_exit(): One or more tests failed."
echo \
"Warning: at_exit(): One or more error occurred:" \
"$FAILED"
fi
}
file2testparams() {
awk '
/^#[ \t]*@Test([ \t]*|$)/ {
sub("^#[ \t]*@Test[ \t]*", "")
print
lines++
filter_tag() {
awk -v tag="$1" '
{
regex = "^#[ \t]*@" tag "([ \t]+|$)"
if($0 ~ regex) {
sub(regex, "")
print
lines++
}
}
END {
if(lines==0) {
exit 1
}
}
END { if (lines==0) { exit 1 } }
' < "$1"
' < "$2"
if test $? = "0" ; then
echo "DEBUG: filter_tag($1, $2): success" >&2
return 0
else
echo "DEBUG: filter_tag($1, $2): not found" >&2
return 1
fi
}
file2testparams() {
filter_tag "Test" "$1"
}
file2testrv() {
filter_tag "TestRv" "$1"
}
add_error() {
msg=$1
echo "Error: $msg" >&2
test -n "$FAILED" && FAILED="$FAILED\\n"
FAILED="$FAILED$msg"
RV=1
}
trap at_exit EXIT
......@@ -36,12 +78,14 @@ if ! cd "$dir" ; then
fi
for script in [0-9]*/[0-9]*sh ; do
if test -n "$scripts" && ! echo "$scripts" | grep -Fq "$script" ; then
continue
fi
if grep -q '^# syntastic=off$' "$script" ; then
echo "Warning: Skipping Shellcheck of \"$script\"." >&2
elif ! shellcheck "$script" ; then
echo "Error: ShellCheck of \"$script\" failed." >&2
RV=1
add_error "ShellCheck of \"$script\" failed."
fi
case "$script" in
......@@ -53,25 +97,26 @@ for script in [0-9]*/[0-9]*sh ; do
echo "Warning: Skipping non-executable \"$script\"." >&2
else
testparams="$(file2testparams "$script")"
test_rv=$?
params_rv=$?
if test "$test_rv" = "0" ; then
# shellcheck disable=SC2086
if "$script" $testparams ; then
echo "Info: \"$script $testparams\" successful."
else
echo "Error: \"$script $testparams\" failed."
testrv="$(file2testrv "$script" || echo 0)"
if test "$params_rv" = "0" ; then
eval "\"$script\" $testparams"
RV=1
scriptrv="$?"
if test "$scriptrv" = "$testrv" ; then
echo "Info: \"$script $testparams\": OK: returned $scriptrv as expected."
else
add_error "\"$script $testparams\": FAIL: returned: $scriptrv; expected $testrv."
fi
else
testscript="tests/$script.t.sh"
if test -f "$testscript" && test -x "$testscript" ; then
if ! "$testscript" "$script" ; then
echo "Error: Unit test of \"$script\" failed." >&2
RV=1
add_error "Unit test of \"$script\" failed."
fi
fi
fi
......