We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8ad4020 commit a066d25Copy full SHA for a066d25
ci/steps/steps-lib.sh
@@ -15,3 +15,13 @@ is_env_var_set() {
15
echo 1
16
fi
17
}
18
+
19
+# Checks whether a directory exists.
20
+directory_exists() {
21
+ local dir="${1:-}"
22
+ if [[ -d "${dir:-}" ]]; then
23
+ echo 0
24
+ else
25
+ echo 1
26
+ fi
27
+}
test/scripts/steps-lib.bats
@@ -14,3 +14,13 @@ source "$SCRIPT"
14
ASDF_TEST_SET="test" run is_env_var_set "ASDF_TEST_SET"
[ "$output" = 0 ]
+@test "directory_exists should 1 if directory doesn't exist" {
+ run directory_exists "/tmp/asdfasdfasdf"
+ [ "$output" = 1 ]
+@test "directory_exists should 0 if directory exists" {
+ run directory_exists "$(pwd)"
+ [ "$output" = 0 ]
0 commit comments