Skip to content

Commit 2d819b9

Browse files
committed
Fix unit test
* New function is_dir() interfered with the output of create_path() * Typo was fixed in ada but should be fixed in unit test as well, to match
1 parent 88e253c commit 2d819b9

2 files changed

Lines changed: 11 additions & 14 deletions

File tree

ada/ada

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,18 +1104,15 @@ is_dir () {
11041104
# Check whether a path is a directory. If the path doesn't exist, just continue.
11051105
# Similar to pathtype(), but that one quits with error if the path doesn't exist.
11061106
encoded_path=$(urlencode "$1")
1107-
command='$debug && set -x
1108-
curl "${curl_authorization[@]}" \
1109-
-H "accept: application/json" \
1110-
--silent \
1111-
-X GET "$api/namespace/$encoded_path"'
1112-
if $dry_run ; then
1113-
echo "$command"
1114-
else
1115-
result=$(eval "$command")
1116-
# The result of the grep will be passed on to the calling statement.
1117-
echo "$result" | jq -r .fileType | grep --silent 'DIR'
1118-
fi
1107+
result=$(
1108+
$debug && set -x
1109+
curl "${curl_authorization[@]}" \
1110+
-H "accept: application/json" \
1111+
--silent \
1112+
-X GET "$api/namespace/$encoded_path" 2>/dev/null
1113+
)
1114+
# The exit code of the grep will be passed on to the calling statement.
1115+
echo "$result" | jq -r .fileType | grep --silent 'DIR'
11191116
}
11201117

11211118

tests/unit_test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ test_create_path() {
3737
( create_path "/test/a" false >${stdoutF} 2>${stderrF} )
3838
result=$?
3939
assertFalse "expecting return code of 1 (false)" ${result}
40-
grep "ERROR: parent dir '/test' does not exist. To recursivly create dirs, add --recursive" "${stderrF}" >/dev/null
40+
grep "ERROR: parent dir '/test' does not exist. To recursively create dirs, add --recursive" "${stderrF}" >/dev/null
4141
assertTrue 'STDERR message incorrect' $?
4242

4343
# Check error handling when max number of directories is exceeded
@@ -147,4 +147,4 @@ oneTimeSetUp() {
147147

148148

149149
# Load and run shunit2
150-
. shunit2
150+
. shunit2

0 commit comments

Comments
 (0)