6 # Tests for installed() with hopefully proper exit codes (1 if the program was
8 installed ls && echo ls installed
9 installed doesnt-exist && echo doesnt-exist installed
11 # Simulate BSD `which` like on Mac OS X which doesn't use exit codes.
13 echo Mac OS X which for $1 >&2
17 echo no doesnt-exist in /usr/bin /bin /usr/sbin /sbin
20 # Tests for installed() without exit codes.
21 installed ls && echo ls installed
22 installed doesnt-exist && echo doesnt-exist installed
25 # Tests for generate().
26 echo "Simple test file for generate() using m4.
34 generate m4 tmp/test -DTEST=m4
35 # Remove the line with the current date as it changes every time.
36 cat tmp/test | grep -v "It was generated from tmp/test.m4"
38 # Test multiple arguments to generate().
39 echo "Test with multiple arguments passed to generate().
42 " > tmp/test-multiple.m4
43 generate m4 tmp/test-multiple -DFIRST=first -DSECOND=second
44 # Remove the line with the current date as it changes every time.
45 cat tmp/test-multiple | grep -v "It was generated from tmp/test-multiple.m4"
47 # Test multiple arguments with spaces to generate().
48 echo "Test with multiple arguments with spaces passed to generate().
51 " > tmp/test-multiple-spaces.m4
52 generate m4 tmp/test-multiple-spaces -DFIRST="first with spaces" \
53 -DSECOND="second with spaces"
54 # Remove the line with the current date as it changes every time.
55 cat tmp/test-multiple-spaces \
56 | grep -v "It was generated from tmp/test-multiple-spaces.m4"
58 # Test generate() using awk.
59 echo "Simple test fiel for generate() using awk.
62 generate awk tmp/test-awk '{ print $1 }'
63 # Remove the line with the current date as it changes every time.
64 cat tmp/test-awk | grep -v "It was generated from tmp/test-awk.in"
66 # Test generate() using cat.
67 echo "Simple test fiel for generate() using cat (simple copy).
71 generate cat tmp/test-cat .real
72 # Remove the line with the current date as it changes every time.
73 cat tmp/test-cat | grep -v "It was generated from tmp/test-cat.real"