3 [ -f testing.sh ] && . testing.sh
14 touch perm/all-read-only
15 chmod a=r perm/all-read-only
17 #testing "name" "command" "result" "infile" "stdin"
21 testing "find -type l -a -type d -o -type p" \
22 "find dir -type l -a -type d -o -type p" "dir/fifo\n" "" ""
23 testing "find -type l -type d -o -type p" "find dir -type l -type d -o -type p" \
25 testing "find -type l -o -type d -a -type p" \
26 "find dir -type l -o -type d -a -type p" "dir/link\n" "" ""
27 testing "find -type l -o -type d -type p" "find dir -type l -o -type d -type p" \
29 testing "find -type l ( -type d -o -type l )" \
30 "find dir -type l \( -type d -o -type l \)" "dir/link\n" "" ""
31 testing "find extra parentheses" \
32 "find dir \( \( -type l \) \( -type d -o \( \( -type l \) \) \) \)" \
34 testing "find ( -type p -o -type d ) -type p" \
35 "find dir \( -type p -o -type d \) -type p" "dir/fifo\n" "" ""
36 testing "find -type l -o -type d -type p -o -type f" \
37 "find dir -type l -o -type d -type p -o -type f | sort" \
38 "dir/file\ndir/link\n" "" ""
40 # Testing short-circuit evaluations
42 testing "find -type f -a -print" \
43 "find dir -type f -a -print" "dir/file\n" "" ""
44 testing "find -print -o -print" \
45 "find dir -type f -a \( -print -o -print \)" "dir/file\n" "" ""
47 # these were erroring or segfaulting:
48 # find -type f -user nobody -exec : \;
49 # find -type f -user nobody -exec : -exec : \;
51 # Testing previous failures
53 testing "find -type f -user -exec" \
54 "find dir -type f -user $USER -exec ls {} \\;" "dir/file\n" "" ""
55 testing "find -type l -newer -exec" \
56 "find dir -type l -newer dir/file -exec ls {} \\;" "dir/link\n" "" ""
57 testing "find -perm (exact success)" \
58 "find perm -type f -perm 0444" "perm/all-read-only\n" "" ""
59 testing "find -perm (exact failure)" \
60 "find perm -type f -perm 0400" "" "" ""
61 testing "find -perm (at least)" \
62 "find perm -type f -perm -0400" "perm/all-read-only\n" "" ""
66 testing "find unterminated -exec {}" \
67 "find dir -type f -exec ls {}" "" "" ""
68 testing "find -exec {} +" \
69 "find dir -type f -exec ls {} +" "dir/file\n" "" ""