aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-08-31 21:27:55 -0700
committerRob Landley <rob@landley.net>2019-09-04 16:12:57 -0500
commit8a5e89bccf04d2d838f96bb063fb3f84f73f980f (patch)
tree632ec096a6dac78f3f0a07a6a6ef9715f10e51a0 /tests
parent2a1b31b92a84b23f7e3ddc5b47930acb95df5486 (diff)
downloadtoybox-8a5e89bccf04d2d838f96bb063fb3f84f73f980f.tar.gz
find: support -printf \0 octal escapes and \c.
I think when I wrote this I tested the named escapes like \n and hex escapes, and when I found \x wasn't supported I didn't even think of octal. And I only learned about \c when I was looking at echo and printf to compare their escape implementations a few weeks back. Add the missing escapes and corresponding tests. Fixes #139.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/find.test7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/find.test b/tests/find.test
index 1f59149b..9129a605 100755
--- a/tests/find.test
+++ b/tests/find.test
@@ -101,6 +101,13 @@ testing "-iwholename glob" "find dir -iwholename 'dIr*E'" "dir/file\n" "" ""
testing "-printf" "find dir -name file -printf '%f %p %P %s'" \
"file dir/file file 0" "" ""
testing "-printf .N" "find dir -name file -printf %.2f" "fi" "" ""
+# findutils find supports C letter escapes and \0 octal, but not \x or \u.
+testing "-printf escapes" \
+ "find dir -name file -printf '\0 \007 \t \079' | xxd -p" \
+ "0020072009200739\n" "" ""
+# findutils find treats \c as "no more output from this -printf", not "no more
+# output from find".
+testing "-printf \\c escape" "find dir -name f* -printf 'x\cy'" "xx" "" ""
# No error message for a dangling link.
ln -s does-not-exist dir/dangler