Skip to content

Commit 2ad6c9e

Browse files
committed
Fix up scripts
1 parent 6b06012 commit 2ad6c9e

File tree

5 files changed

+26
-20
lines changed

5 files changed

+26
-20
lines changed

bin/is-executable

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env bash
2+
13
if type "$1" >/dev/null 2>&1; then
24
exit 0
35
else

bin/is-macos

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env bash
2+
13
if [[ "$OSTYPE" =~ ^darwin ]]; then
24
exit 0
35
else

bin/is-supported

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env bash
2+
13
if [ $# -eq 1 ]; then
24
if eval "$1" > /dev/null 2>&1; then
35
exit 0

test/bin.bats

+20
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,26 @@
1111
[ "$ACTUAL" = "$EXPECTED" ]
1212
}
1313

14+
@test "is-executable" {
15+
run is-executable ls
16+
[ "$status" -eq 0 ]
17+
}
18+
19+
@test "is-executable (false)" {
20+
run is-executable nonexistent
21+
[ "$status" -eq 1 ]
22+
}
23+
24+
@test "is-supported" {
25+
run is-supported ls -a
26+
[ "$status" -eq 0 ]
27+
}
28+
29+
@test "is-supported (false)" {
30+
run is-supported "ls --nonexistent"
31+
[ "$status" -eq 1 ]
32+
}
33+
1434
@test "set-config" {
1535
run set-config KEY_A VALUE_1 MYFILE
1636
run set-config KEY_B VALUE_2 MYFILE

test/function.bats

-20
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,6 @@ FIXTURE_TEXT="foo"
1212
[ "$ACTUAL" = "$EXPECTED" ]
1313
}
1414

15-
@test "is-executable" {
16-
run is-executable ls
17-
[ "$status" -eq 0 ]
18-
}
19-
20-
@test "is-executable (false)" {
21-
run is-executable nonexistent
22-
[ "$status" -eq 1 ]
23-
}
24-
25-
@test "is-supported" {
26-
run is-supported ls -a
27-
[ "$status" -eq 0 ]
28-
}
29-
30-
@test "is-supported (false)" {
31-
run is-supported "ls --nonexistent"
32-
[ "$status" -eq 1 ]
33-
}
34-
3515
@test "calc" {
3616
ACTUAL="$(calc 1+2)"
3717
EXPECTED=3

0 commit comments

Comments
 (0)