aboutsummaryrefslogtreecommitdiff
path: root/testsuite/find.tests
blob: 78dfa123033e9f881d144c22159ba88aba5ee663 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh

# Copyright 2014 by Denys Vlasenko <vda.linux@googlemail.com>
# Licensed under GPLv2, see file LICENSE in this source tree.

. ./testing.sh

# testing "description" "command" "result" "infile" "stdin"

mkdir -p find.tempdir
touch find.tempdir/testfile

optional FEATURE_FIND_TYPE
testing "find -type f" \
	"cd find.tempdir && find -type f 2>&1" \
	"./testfile\n" \
	"" ""
SKIP=
optional FEATURE_FIND_EXEC
testing "find -exec exitcode 1" \
	"cd find.tempdir && find testfile -exec true {} \; 2>&1; echo \$?" \
	"0\n" \
	"" ""
SKIP=
optional FEATURE_FIND_EXEC_PLUS
testing "find -exec exitcode 2" \
	"cd find.tempdir && find testfile -exec true {} + 2>&1; echo \$?" \
	"0\n" \
	"" ""
SKIP=
# Surprisingly, "-exec false ;" results in exitcode 0! "-exec false +" is different!!!
optional FEATURE_FIND_EXEC
testing "find -exec exitcode 3" \
	"cd find.tempdir && find testfile -exec false {} \; 2>&1; echo \$?" \
	"0\n" \
	"" ""
SKIP=
optional FEATURE_FIND_EXEC_PLUS
testing "find -exec exitcode 4" \
	"cd find.tempdir && find testfile -exec false {} + 2>&1; echo \$?" \
	"1\n" \
	"" ""
SKIP=

# testing "description" "command" "result" "infile" "stdin"

rm -rf find.tempdir

exit $FAILCOUNT