Skip to content

Commit 0e20bed

Browse files
committed
tests: be compatible with bats 1.2
This is what github actions uses.
1 parent 5d9e1b9 commit 0e20bed

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

tests/run_tests.sh

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env bats
22

3-
bats_require_minimum_version 1.5.0
4-
53
function setup() {
64
cd "$(dirname "$BATS_TEST_FILENAME")"
75
}
@@ -102,7 +100,8 @@ set_sha256 "65336230633434323938666331633134396166626634633839393666623932343237
102100
@test "Corrupt file should be flagged" {
103101
echo "123" > foo.txt
104102
TZ=CET touch -t 201901010000 foo.txt
105-
run ! ../cshatag foo.txt &> /dev/null
103+
run ../cshatag foo.txt &> /dev/null
104+
[ "$status" -ne 0 ]
106105
}
107106

108107
@test "Corrupt file should look ok on 2nd run" {
@@ -128,12 +127,14 @@ fi
128127
}
129128

130129
@test "Testing nonexisting file" {
131-
run -2 ../cshatag nonexisting.txt &> /dev/null
130+
run ../cshatag nonexisting.txt &> /dev/null
131+
[ "$status" -eq 2 ]
132132
}
133133

134134
@test "Testing symlink" {
135135
ln -s / symlink1
136-
run -3 ../cshatag symlink1 &> /dev/null
136+
run ../cshatag symlink1 &> /dev/null
137+
[ "$status" -eq 3 ]
137138
rm -f symlink1
138139
}
139140

@@ -151,7 +152,8 @@ rm foo.txt
151152
rm -rf foo
152153
mkdir foo
153154
TZ=CET touch -t 201901010000 foo/foo.txt
154-
run -3 bash -c "../cshatag foo 2> 7.err"
155+
run bash -c "../cshatag foo 2> 7.err"
156+
[ "$status" -eq 3 ]
155157
diff -u 7.expected 7.err
156158
../cshatag --recursive foo > 8.out
157159
diff -u 8.expected 8.out
@@ -183,5 +185,6 @@ touch --date="2023-04-16 20:56:16.585798497+02:00" foo.txt
183185
../cshatag foo.txt > /dev/null
184186
echo asd > foo.txt
185187
touch --date="2023-04-16 20:56:16.585798400+02:00" foo.txt
186-
run -5 ../cshatag foo.txt &> /dev/null
188+
run ../cshatag foo.txt &> /dev/null
189+
[ "$status" -eq 5 ]
187190
}

0 commit comments

Comments
 (0)