6 # which with proper exit codes and output to stdout.
11 echo no doesnt-exist in /usr/bin /bin /usr/sbin /sbin
16 installed ls && echo ls installed
17 installed doesnt-exist && echo doesnt-exist installed
19 # which with proper exit codes and output to stderr in case of an error.
24 echo no doesnt-exist in /usr/bin /bin /usr/sbin /sbin >&2
29 installed ls && echo ls installed
30 installed doesnt-exist && echo doesnt-exist installed
32 # which with no proper exit codes and output to stdout in case of an error.
37 echo no doesnt-exist in /usr/bin /bin /usr/sbin /sbin
41 installed ls && echo ls installed
42 installed doesnt-exist && echo doesnt-exist installed
45 # Tests for generate().
46 echo "Simple test file for generate() using m4.
54 generate m4 tmp/test -DTEST=m4
55 # Remove the line with the current date as it changes every time.
56 cat tmp/test | grep -v "It was generated from tmp/test.m4"
58 # Test multiple arguments to generate().
59 echo "Test with multiple arguments passed to generate().
62 " > tmp/test-multiple.m4
63 generate m4 tmp/test-multiple -DFIRST=first -DSECOND=second
64 # Remove the line with the current date as it changes every time.
65 cat tmp/test-multiple | grep -v "It was generated from tmp/test-multiple.m4"
67 # Test multiple arguments with spaces to generate().
68 echo "Test with multiple arguments with spaces passed to generate().
71 " > tmp/test-multiple-spaces.m4
72 generate m4 tmp/test-multiple-spaces -DFIRST="first with spaces" \
73 -DSECOND="second with spaces"
74 # Remove the line with the current date as it changes every time.
75 cat tmp/test-multiple-spaces \
76 | grep -v "It was generated from tmp/test-multiple-spaces.m4"
78 # Test generate() using awk.
79 echo "Simple test fiel for generate() using awk.
82 generate awk tmp/test-awk '{ print $1 }'
83 # Remove the line with the current date as it changes every time.
84 cat tmp/test-awk | grep -v "It was generated from tmp/test-awk.in"
86 # Test generate() using perl.
87 echo "Simple test fiel for generate() using perl.
90 generate perl tmp/test-perl -p -e 's/first/best/'
91 # Remove the line with the current date as it changes every time.
92 cat tmp/test-perl | grep -v "It was generated from tmp/test-perl.in"
94 # Test generate() using cat.
95 echo "Simple test fiel for generate() using cat (simple copy).
99 generate cat tmp/test-cat .real
100 # Remove the line with the current date as it changes every time.
101 cat tmp/test-cat | grep -v "It was generated from tmp/test-cat.real"