Skip to content

Commit 1133a03

Browse files
committed
CI: add several tests for exit code checking
1 parent 1be022f commit 1133a03

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

ci/run_tests.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,5 +158,42 @@ pushd cpp_files
158158
"$fpm" test
159159
popd
160160

161+
# Test app exit codes
162+
pushd fpm_test_exit_code
163+
"$fpm" build
164+
165+
# odd number -> return 0
166+
EXIT_CODE=0
167+
"$fpm" run -- 1 || EXIT_CODE=$?
168+
test $EXIT_CODE -eq 0
169+
170+
# even number -> return 3
171+
EXIT_CODE=0
172+
"$fpm" run -- 512 || EXIT_CODE=$?
173+
test $EXIT_CODE -eq 3
174+
175+
# even number -> return 3
176+
EXIT_CODE=0
177+
"$fpm" run -- 0 || EXIT_CODE=$?
178+
test $EXIT_CODE -eq 3
179+
180+
# not an integer -> return 3
181+
EXIT_CODE=0
182+
"$fpm" run -- 3.1415 || EXIT_CODE=$?
183+
test $EXIT_CODE -eq 2
184+
185+
# not a number
186+
EXIT_CODE=0
187+
"$fpm" run -- notanumber || EXIT_CODE=$?
188+
test $EXIT_CODE -eq 2
189+
190+
# no arguments
191+
EXIT_CODE=0
192+
"$fpm" run || EXIT_CODE=$?
193+
test $EXIT_CODE -eq 1
194+
195+
popd
196+
197+
161198
# Cleanup
162199
rm -rf ./*/build

0 commit comments

Comments
 (0)