Compare commits
3 commits
32dd66f0a8
...
f1054a71ca
Author | SHA1 | Date | |
---|---|---|---|
f1054a71ca | |||
99a88d4898 | |||
074ed0199a |
3 changed files with 12 additions and 2 deletions
14
test.sh
14
test.sh
|
@ -40,14 +40,24 @@ process_args () {
|
||||||
function usage (){
|
function usage (){
|
||||||
msg "\n**Script de test de code retour**\n"
|
msg "\n**Script de test de code retour**\n"
|
||||||
msg "Ce script permet de comparer les codes retour attendu et ceux obtenus\n"
|
msg "Ce script permet de comparer les codes retour attendu et ceux obtenus\n"
|
||||||
msg "Dans le cadre du Mooc bash de la licence ADSILLH\n\n"
|
msg "Dans le cadre du Mooc bash de la licence ADSILLH\n"
|
||||||
|
msg "\n__USAGE__\n\n"
|
||||||
|
msg "$0 -d <rep> -s <script> -t <test>\n\n"
|
||||||
|
msg "-d\trépertoire ou se trouve le script à tester\n"
|
||||||
|
msg "-s\tnom du script à tester\n"
|
||||||
|
msg "-t\tfichier texte contenant les paramètres et codes retour attendus\n"
|
||||||
|
msg "\tCe fichier contient un test par lignes sous la forme\n"
|
||||||
|
msg "\t<arguments>**:**<code_retour_attendu>\n\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
echo " Hououuuu ${PWD}"
|
msg "**ADSILLH Bash return code test**\n"
|
||||||
process_args $@
|
process_args $@
|
||||||
|
[[ -z $COMMAND || -z $TEST_FILE ]] && error "You must specity a command and a test file"
|
||||||
msg "Test $COMMAND script with $TEST_FILE\n\n"
|
msg "Test $COMMAND script with $TEST_FILE\n\n"
|
||||||
|
|
||||||
cd $DIR
|
cd $DIR
|
||||||
|
[ ! -f $COMMAND ] && error "script **$COMMAND** not found"
|
||||||
|
|
||||||
while IFS='' read -r i || [[ -n "$line" ]]; do
|
while IFS='' read -r i || [[ -n "$line" ]]; do
|
||||||
args=$(echo $i | cut -d: -f1)
|
args=$(echo $i | cut -d: -f1)
|
||||||
e_code=$(echo $i | cut -d: -f2)
|
e_code=$(echo $i | cut -d: -f2)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue