[Toybox] [PATCH] Add find tests.
Daniel K. Levy
alliedenvy at gmail.com
Mon Sep 14 14:45:17 PDT 2015
On Mon, 2015-09-14 at 14:34 -0700, enh wrote:
> maybe use touch and explicit timestamps to ensure you have known
> state? (the original example was more like "touch file1 ; sleep 1;
> touch file2 file3", but sleeps in tests are best avoided.)
Yep, you beat me to it :)
Better tests, on top of head:
diff --git a/tests/find.test b/tests/find.test
index 65bbb50..340bc0c 100755
--- a/tests/find.test
+++ b/tests/find.test
@@ -39,8 +39,17 @@ testing "find -type f -a -print" \
testing "find -print -o -print" \
"find dir -type f -a \( -print -o -print \)" "dir/file\n" "" ""
-# these were erroring or segfaulting:
-# find -type f -user nobody -exec : \;
-# find -type f -user nobody -exec : -exec : \;
+# Testing previous failures
+
+testing "find -type f -user -exec" \
+ "find dir -type f -user $USER -exec ls {} \\;" "dir/file\n" "" ""
+
+TZ=UTC touch -t 196907210256.15 dir/file # Vingean epoch
+testing "find -type l -newer -exec" \
+ "find dir -type l -newer dir/file -exec ls {} \\;" "dir/link\n" "" ""
+testing "find unterminated -exec {} [fail]" \
+ "find dir -type f -exec ls {} 2>/dev/null || echo yes" "yes\n" "" ""
+testing "find -exec {} +" \
+ "find dir -type f -exec ls {} +" "dir/file\n" "" ""
rm -rf dir
1442267117.0
More information about the Toybox
mailing list