tests with nested directories

This commit is contained in:
Thomas Levine 2016-02-28 12:53:26 +00:00
parent 6b98a5a946
commit 0fdd14494c
3 changed files with 14 additions and 10 deletions

View File

View File

24
urchin
View File

@ -135,8 +135,6 @@ recurse() {
mkdir -p "$(dirname "$stdout_file")" mkdir -p "$(dirname "$stdout_file")"
mkdir -p "$(dirname "$time_file")" mkdir -p "$(dirname "$time_file")"
> $stdout_file
if [ -x "$potential_test" ]; then if [ -x "$potential_test" ]; then
cd -- "$(dirname "$potential_test")" cd -- "$(dirname "$potential_test")"
urchin_source setup urchin_source setup
@ -191,10 +189,10 @@ report_outcome() {
escaped_root="$(fullpath "$root" | sed 's/\//\\\//g')" escaped_root="$(fullpath "$root" | sed 's/\//\\\//g')"
elapsed=$(($finish - $start)) elapsed=$(($finish - $start))
# if "$tap_format"; then if "$tap_format"; then
# printf \#\ printf \#\
# fi fi
# echo Running tests at $(date +%Y-%m-%dT%H:%M:%S) echo Running tests at $(date +%Y-%m-%dT%H:%M:%S)
for number in n oks skips not_oks; do for number in n oks skips not_oks; do
eval "$number=0" eval "$number=0"
@ -210,6 +208,9 @@ report_outcome() {
result=$(echo "$line" | sed "s/$regex/\2/") result=$(echo "$line" | sed "s/$regex/\2/")
file_elapsed=$(echo "$line" | sed "s/$regex/\3/") file_elapsed=$(echo "$line" | sed "s/$regex/\3/")
prevdir=$currentdir
currentdir="$(dirname "$path")"
# Number of files that have run, including this one # Number of files that have run, including this one
n=$(($n + 1)) n=$(($n + 1))
@ -241,6 +242,9 @@ report_outcome() {
fi fi
echo "# Previous test took $file_elapsed seconds." echo "# Previous test took $file_elapsed seconds."
else else
if test "$prevdir" != "$currentdir"; then
echo
fi
case "$result" in case "$result" in
ok) ok)
# On success, print a green '✓' # On success, print a green '✓'
@ -255,7 +259,9 @@ report_outcome() {
# Print output captured from not_oked test in red. # Print output captured from not_oked test in red.
printf '\033[31m' printf '\033[31m'
cat "$stdout_file" if test -f "$stdout_file"; then
cat "$stdout_file"
fi
printf '\033[0m' printf '\033[0m'
;; ;;
skip) skip)
@ -264,9 +270,6 @@ report_outcome() {
esac esac
fi fi
if ! $tap_format; then
echo
fi
done < $sorted_log_file done < $sorted_log_file
rm $sorted_log_file rm $sorted_log_file
@ -275,6 +278,7 @@ report_outcome() {
echo "# Full test suite took $elapsed $(plural second $elapsed)." echo "# Full test suite took $elapsed $(plural second $elapsed)."
echo 1..$n echo 1..$n
else else
echo
echo "Done, took $elapsed $(plural second $elapsed)." echo "Done, took $elapsed $(plural second $elapsed)."
printf '%s\n' "$oks $(plural test "$oks") passed." printf '%s\n' "$oks $(plural test "$oks") passed."
printf '%s\n' "$skips $(plural test "$skips") skip." printf '%s\n' "$skips $(plural test "$skips") skip."