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
44 # which with proper exit codes and no output in case of an error.
53 installed ls && echo ls installed
54 installed doesnt-exist && echo doesnt-exist installed
57 # Tests for generate().
58 echo "Simple test file for generate() using m4.
66 generate m4 tmp/test -DTEST=m4
67 # Remove the line with the current date as it changes every time.
68 cat tmp/test | grep -v "It was generated from tmp/test.m4"
70 # Test multiple arguments to generate().
71 echo "Test with multiple arguments passed to generate().
74 " > tmp/test-multiple.m4
75 generate m4 tmp/test-multiple -DFIRST=first -DSECOND=second
76 # Remove the line with the current date as it changes every time.
77 cat tmp/test-multiple | grep -v "It was generated from tmp/test-multiple.m4"
79 # Test multiple arguments with spaces to generate().
80 echo "Test with multiple arguments with spaces passed to generate().
83 " > tmp/test-multiple-spaces.m4
84 generate m4 tmp/test-multiple-spaces -DFIRST="first with spaces" \
85 -DSECOND="second with spaces"
86 # Remove the line with the current date as it changes every time.
87 cat tmp/test-multiple-spaces \
88 | grep -v "It was generated from tmp/test-multiple-spaces.m4"
90 # Test generate() using awk.
91 echo "Simple test fiel for generate() using awk.
94 generate awk tmp/test-awk '{ print $1 }'
95 # Remove the line with the current date as it changes every time.
96 cat tmp/test-awk | grep -v "It was generated from tmp/test-awk.in"
98 # Test generate() using perl.
99 echo "Simple test fiel for generate() using perl.
102 generate perl tmp/test-perl -p -e 's/first/best/'
103 # Remove the line with the current date as it changes every time.
104 cat tmp/test-perl | grep -v "It was generated from tmp/test-perl.in"
106 # Test generate() using cat.
107 echo "Simple test fiel for generate() using cat (simple copy).
110 " > tmp/test-cat.real
111 generate cat tmp/test-cat .real
112 # Remove the line with the current date as it changes every time.
113 cat tmp/test-cat | grep -v "It was generated from tmp/test-cat.real"