summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2017-08-12 16:23:43 -0400
committerTavian Barnes <tavianator@tavianator.com>2017-08-12 16:23:59 -0400
commit01a754bc5572103f9a49242d756dc04b0e86bb6e (patch)
tree123596dc7b98b8808f48436cd5511e1ee41e49ee
parent975344d26e038bb935309bcf33325d202a880fc4 (diff)
downloadbfs-01a754bc5572103f9a49242d756dc04b0e86bb6e.tar.xz
tests: Add a test for -exec ... {} + with a failing command
-rwxr-xr-xtests.sh8
-rw-r--r--tests/test_exec_plus_status.out19
2 files changed, 27 insertions, 0 deletions
diff --git a/tests.sh b/tests.sh
index cf9e1a3..88e93b1 100755
--- a/tests.sh
+++ b/tests.sh
@@ -187,6 +187,7 @@ posix_tests=(
test_size_bytes
test_exec
test_exec_plus
+ test_exec_plus_status
test_exec_plus_semicolon
test_flag_comma
test_perm_222
@@ -779,6 +780,13 @@ function test_exec_plus() {
bfs_diff basic -exec "$TESTS/sort-args.sh" '{}' +
}
+function test_exec_plus_status() {
+ # -exec ... {} + should always return true, but if the command fails, bfs
+ # should exit with a non-zero status
+ bfs_diff basic -exec false '{}' + -print
+ ! invoke_bfs basic -exec false '{}' +
+}
+
function test_exec_plus_semicolon() {
# POSIX says:
# Only a <plus-sign> that immediately follows an argument containing only the two characters "{}"
diff --git a/tests/test_exec_plus_status.out b/tests/test_exec_plus_status.out
new file mode 100644
index 0000000..bb3cd8d
--- /dev/null
+++ b/tests/test_exec_plus_status.out
@@ -0,0 +1,19 @@
+basic
+basic/a
+basic/b
+basic/c
+basic/e
+basic/g
+basic/i
+basic/j
+basic/k
+basic/l
+basic/c/d
+basic/e/f
+basic/g/h
+basic/j/foo
+basic/k/foo
+basic/l/foo
+basic/k/foo/bar
+basic/l/foo/bar
+basic/l/foo/bar/baz