From ce6ef6d1869ad44c64bba4dad6a68da3eabebedd Mon Sep 17 00:00:00 2001 From: nprimo Date: Thu, 12 Jan 2023 12:43:05 +0000 Subject: [PATCH] refactor(array-selector): refactor test - make challenge a variadic function - simplify test using challenge for all the test cases --- sh/tests/array-selector_test.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sh/tests/array-selector_test.sh b/sh/tests/array-selector_test.sh index 11bf7ca7d..278c5f9cc 100755 --- a/sh/tests/array-selector_test.sh +++ b/sh/tests/array-selector_test.sh @@ -9,8 +9,8 @@ IFS=' script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd) challenge() { - submitted=$(bash "$script_dirS"/student/array-selector.sh $1) - expected=$(bash "$script_dirS"/solutions/array-selector.sh $1) + submitted=$(bash "$script_dirS"/student/array-selector.sh "$@") + expected=$(bash "$script_dirS"/solutions/array-selector.sh "$@") diff <(echo "$submitted") <(echo "$expected") } @@ -27,7 +27,4 @@ challenge "abc" # Test with wrong number of arguments -submitted=$(bash "$script_dirS"/student/array-selector.sh) -submitted=$(bash "$script_dirS"/solutions/array-selector.sh) - -diff <(echo "$submitted") <(echo "$expected") +challenge