Skip to content

Commit

Permalink
docs(grades): fix test and error message
Browse files Browse the repository at this point in the history
  • Loading branch information
MSilva95 committed Feb 2, 2023
1 parent 1f9b277 commit 36f079d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions sh/tests/grades_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,9 +24,8 @@ EOF
if [ $? != 0 ]; then
exit 1
fi
echo $submitted
echo $expected
}

challenge 1 "Student1
90
"
Expand Down Expand Up @@ -83,3 +83,6 @@ not_good
challenge 1 "Student1
-75
"
challenge 1 1 "Louis
20
"
2 changes: 1 addition & 1 deletion sh/tests/solutions/grades.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion subjects/devops/grades/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!
$
```

Expand Down

0 comments on commit 36f079d

Please sign in to comment.