We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9f104ae commit 1a78afeCopy full SHA for 1a78afe
ci/steps/steps-lib.sh
@@ -25,3 +25,13 @@ directory_exists() {
25
echo 1
26
fi
27
}
28
+
29
+# Checks whether a file exists.
30
+file_exists() {
31
+ local file="${1:-}"
32
+ if test -f "${file:-}"; then
33
+ echo 0
34
+ else
35
+ echo 1
36
+ fi
37
+}
test/scripts/steps-lib.bats
@@ -23,4 +23,14 @@ source "$SCRIPT"
23
@test "directory_exists should 0 if directory exists" {
24
run directory_exists "$(pwd)"
[ "$output" = 0 ]
+@test "file_exists should 1 if file doesn't exist" {
+ run file_exists "hello-asfd.sh"
+ [ "$output" = 1 ]
+@test "file_exists should 0 if file exists" {
+ run file_exists "steps-lib.bats"
+ [ "$output" = 0 ]
0 commit comments