reparation de la suppression des fichiers crees, ajout possibilite entrer un fichier sans extension sh, recuperation automatique des fichiers dans dossier default
This commit is contained in:
26
unitests.sh
26
unitests.sh
@@ -2,6 +2,8 @@
|
||||
cd $(dirname $0)
|
||||
|
||||
MINISHELL="../minishell"
|
||||
TEST_DIR="./tests/"
|
||||
DEFAULT_DIR="./tests/defaults/"
|
||||
|
||||
# COLORS
|
||||
RED="\e[0;31m"
|
||||
@@ -41,14 +43,7 @@ MINISHELL="../minishell"
|
||||
MINISHELL_LOG="./logs/minishell_log.txt"
|
||||
|
||||
# default list of files to be use
|
||||
default_files="\
|
||||
ut_builtins.sh
|
||||
ut_exit_status.sh
|
||||
ut_expensions.sh
|
||||
ut_heredocs.sh
|
||||
ut_pipes.sh
|
||||
ut_redirections.sh
|
||||
ut_vrac.sh"
|
||||
default_files="$( find $DEFAULT_DIR | tail -n+2 )"
|
||||
|
||||
# print usage
|
||||
function print_usage
|
||||
@@ -97,7 +92,7 @@ MINISHELL="../minishell"
|
||||
DIFF_FILES="$(comm -3 <(echo "$FILES_BEFORE") <(echo "$FILES_AFTER"))"
|
||||
while read line_diff
|
||||
do
|
||||
rm -r "$line_diff"
|
||||
rm -rf "$line_diff"
|
||||
done < <(echo "$DIFF_FILES")
|
||||
}
|
||||
|
||||
@@ -139,16 +134,22 @@ MINISHELL="../minishell"
|
||||
list_files=""
|
||||
for (( i = $START ; i <= "$#" ; i++ ))
|
||||
do
|
||||
if [ -e "${!i}" ]
|
||||
# the ! is for indirect parameter expansion
|
||||
# $i expand in integers 1,2,3...
|
||||
# $1,$2,$3... expand in arguments of process call
|
||||
FILE="${!i/#/$TEST_DIR}"
|
||||
FILE="${FILE%.sh}"
|
||||
FILE="${FILE/%/.sh}"
|
||||
if [ -e "$FILE" ]
|
||||
then
|
||||
if [ -n "$list_files" ]
|
||||
then
|
||||
list_files+=$'\n'
|
||||
fi
|
||||
list_files+="${!i}"
|
||||
list_files+="$FILE"
|
||||
else
|
||||
print_usage
|
||||
echo " \"${!i}\" is not a valid file or option, see usage above"
|
||||
echo " <$FILE> is not a valid file or option, see usage above"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
@@ -283,6 +284,7 @@ MINISHELL="../minishell"
|
||||
echo ""
|
||||
print_results "all" $TOTAL_SUCCESS $TOTAL_TEST
|
||||
fi
|
||||
delete_files
|
||||
|
||||
# ask to show the diff
|
||||
# -rsn1 will stop read after first key pressed
|
||||
|
||||
Reference in New Issue
Block a user