docs(grades): fix test and error message

This commit is contained in:
miguel 2023-02-01 17:10:41 +00:00 committed by MSilva95
parent 1f9b277887
commit 36f079db98
3 changed files with 9 additions and 6 deletions

View File

@ -5,8 +5,9 @@ IFS='
script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd)
challenge() {
args=$1
input=$2
input="${@: -1}"
args=${@:1:$#-1}
submitted=$(
bash -c ""$script_dirS"/student/grades.sh $args" <<EOF
@ -23,9 +24,8 @@ EOF
if [ $? != 0 ]; then
exit 1
fi
echo $submitted
echo $expected
}
challenge 1 "Student1
90
"
@ -83,3 +83,6 @@ not_good
challenge 1 "Student1
-75
"
challenge 1 1 "Louis
20
"

View File

@ -4,7 +4,7 @@ num_students=$1
declare -a students
if [ $# -ne 1 ]; then
echo "Error: Expect 1 argument only!"
echo "Error: expect 1 argument only!"
exit 1
fi

View File

@ -66,7 +66,7 @@ Student Name #1: Bob
Student Grade #1: ten
Error: The grade 'ten' is not a valid input. Only numerical grades between 0 and 100 are accepted.
$ ./grades.sh 1 2 3
Error: Expect 1 argument only!
Error: expect 1 argument only!
$
```