We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3e07544 commit e834616Copy full SHA for e834616
ci/steps/steps-lib.sh
@@ -35,3 +35,13 @@ file_exists() {
35
echo 1
36
fi
37
}
38
+
39
+# Checks whether a file is executable.
40
+is_executable() {
41
+ local file="${1:-}"
42
+ if [ -f "${file}" ] && [ -r "${file}" ] && [ -x "${file}" ]; then
43
+ echo 0
44
+ else
45
+ echo 1
46
+ fi
47
+}
test/scripts/steps-lib.bats
@@ -33,4 +33,14 @@ source "$SCRIPT"
33
@test "file_exists should 0 if file exists" {
34
run file_exists "steps-lib.bats"
[ "$output" = 0 ]
+@test "is_executable should 1 if file isn't executable" {
+ run is_executable "hello-asfd.sh"
+ [ "$output" = 1 ]
+@test "is_executable should 0 if file is executable" {
+ run is_executable "$SCRIPT"
+ [ "$output" = 0 ]
0 commit comments