1
1
#! /usr/bin/env bats
2
2
3
- bats_require_minimum_version 1.5.0
4
-
5
3
function setup() {
6
4
cd " $( dirname " $BATS_TEST_FILENAME " ) "
7
5
}
@@ -102,7 +100,8 @@ set_sha256 "65336230633434323938666331633134396166626634633839393666623932343237
102
100
@test " Corrupt file should be flagged" {
103
101
echo " 123" > foo.txt
104
102
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 ]
106
105
}
107
106
108
107
@test " Corrupt file should look ok on 2nd run" {
128
127
}
129
128
130
129
@test " Testing nonexisting file" {
131
- run -2 ../cshatag nonexisting.txt & > /dev/null
130
+ run ../cshatag nonexisting.txt & > /dev/null
131
+ [ " $status " -eq 2 ]
132
132
}
133
133
134
134
@test " Testing symlink" {
135
135
ln -s / symlink1
136
- run -3 ../cshatag symlink1 & > /dev/null
136
+ run ../cshatag symlink1 & > /dev/null
137
+ [ " $status " -eq 3 ]
137
138
rm -f symlink1
138
139
}
139
140
@@ -151,7 +152,8 @@ rm foo.txt
151
152
rm -rf foo
152
153
mkdir foo
153
154
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 ]
155
157
diff -u 7.expected 7.err
156
158
../cshatag --recursive foo > 8.out
157
159
diff -u 8.expected 8.out
@@ -183,5 +185,6 @@ touch --date="2023-04-16 20:56:16.585798497+02:00" foo.txt
183
185
../cshatag foo.txt > /dev/null
184
186
echo asd > foo.txt
185
187
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 ]
187
190
}
0 commit comments