Browse Source

Make it work with non-executable scripts

pull/804/head
xpetit 3 years ago
parent
commit
dd0b515691
No known key found for this signature in database
GPG Key ID: 97C60669182C17A5
  1. 4
      sh/tests/cl-camp1_test.sh
  2. 4
      sh/tests/cl-camp3_test.sh
  3. 4
      sh/tests/cl-camp4_test.sh
  4. 4
      sh/tests/cl-camp5_test.sh
  5. 4
      sh/tests/cl-camp6_test.sh
  6. 4
      sh/tests/cl-camp8_test.sh
  7. 4
      sh/tests/explain_test.sh
  8. 4
      sh/tests/now-get-to-work_test.sh
  9. 5
      sh/tests/teacher_test.sh

4
sh/tests/cl-camp1_test.sh

@ -8,8 +8,8 @@ IFS='
script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd)
challenge() {
submitted=$(cd "$1" && "$script_dirS"/student/mastertheLS)
expected=$(cd "$1" && "$script_dirS"/solutions/mastertheLS)
submitted=$(cd "$1" && bash "$script_dirS"/student/mastertheLS)
expected=$(cd "$1" && bash "$script_dirS"/solutions/mastertheLS)
diff <(echo "$submitted") <(echo "$expected")
}

4
sh/tests/cl-camp3_test.sh

@ -8,8 +8,8 @@ IFS='
script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd)
challenge() {
submitted=$(cd "$1" && "$script_dirS"/student/look)
expected=$(cd "$1" && "$script_dirS"/solutions/look)
submitted=$(cd "$1" && bash "$script_dirS"/student/look)
expected=$(cd "$1" && bash "$script_dirS"/solutions/look)
diff <(echo "$submitted") <(echo "$expected")
}

4
sh/tests/cl-camp4_test.sh

@ -9,8 +9,8 @@ echo insecure >> ~/.curlrc
caddy start &>/dev/null
challenge() {
submitted=$(./student/myfamily.sh)
expected=$(./solutions/myfamily.sh)
submitted=$(bash student/myfamily.sh)
expected=$(bash solutions/myfamily.sh)
diff <(echo "$submitted") <(echo "$expected")
}

4
sh/tests/cl-camp5_test.sh

@ -8,8 +8,8 @@ IFS='
script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd)
challenge() {
submitted=$(cd "$1" && "$script_dirS"/student/lookagain.sh)
expected=$(cd "$1" && "$script_dirS"/solutions/lookagain.sh)
submitted=$(cd "$1" && bash "$script_dirS"/student/lookagain.sh)
expected=$(cd "$1" && bash "$script_dirS"/solutions/lookagain.sh)
diff <(echo "$submitted") <(echo "$expected")
}

4
sh/tests/cl-camp6_test.sh

@ -8,8 +8,8 @@ IFS='
script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd)
challenge() {
submitted=$(cd "$1" && "$script_dirS"/student/countfiles.sh)
expected=$(cd "$1" && "$script_dirS"/solutions/countfiles.sh)
submitted=$(cd "$1" && bash "$script_dirS"/student/countfiles.sh)
expected=$(cd "$1" && bash "$script_dirS"/solutions/countfiles.sh)
diff <(echo "$submitted") <(echo "$expected")
}

4
sh/tests/cl-camp8_test.sh

@ -7,7 +7,7 @@ IFS='
cd cl-camp8
submitted=$(../student/skip.sh)
expected=$(../solutions/skip.sh)
submitted=$(bash ../student/skip.sh)
expected=$(bash ../solutions/skip.sh)
diff <(echo "$submitted") <(echo "$expected")

4
sh/tests/explain_test.sh

@ -5,8 +5,8 @@ set -euo pipefail
IFS='
'
submitted=$(student/explain.sh)
expected=$(solutions/explain.sh)
submitted=$(bash student/explain.sh)
expected=$(bash solutions/explain.sh)
if ! diff -q <(echo "$submitted") <(echo "$expected") &>/dev/null; then
echo "Wrong answer, detective."

4
sh/tests/now-get-to-work_test.sh

@ -5,8 +5,8 @@ set -euo pipefail
IFS='
'
submitted=$(student/my_answer.sh)
expected=$(solutions/my_answer.sh)
submitted=$(bash student/my_answer.sh)
expected=$(bash solutions/my_answer.sh)
if ! diff -q <(echo "$submitted") <(echo "$expected") &>/dev/null; then
echo "Wrong answer, detective."

5
sh/tests/teacher_test.sh

@ -7,10 +7,9 @@ IFS='
script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd)
challenge() {
submitted=$(cd "$1" && "$script_dirS"/student/teacher.sh) || (echo "Your script exited with a non-zero status code"; exit 1)
expected=$(cd "$1" && "$script_dirS"/solutions/teacher.sh)
submitted=$(cd "$1" && bash "$script_dirS"/student/teacher.sh) || (echo "Your script exited with a non-zero status code"; exit 1)
expected=$(cd "$1" && bash "$script_dirS"/solutions/teacher.sh)
if ! diff -q <(echo "$submitted") <(echo "$expected") &>/dev/null; then
echo "??? What ?? Wrong answer, teacher. Did you really do the job previously? Or was is just an \"echo\" of luck??"

Loading…
Cancel
Save