3 # Copyright (C) 2009-2013 Simon Ruderich
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 # Tests for generate().
23 echo "Simple test file for generate() using m4.
31 generate m4 tmp/test -DTEST=m4
32 # Remove the line with the current date as it changes every time.
33 cat tmp/test | grep -v "It was generated from tmp/test.m4"
35 # Test multiple arguments to generate().
36 echo "Test with multiple arguments passed to generate().
39 " > tmp/test-multiple.m4
40 generate m4 tmp/test-multiple -DFIRST=first -DSECOND=second
41 # Remove the line with the current date as it changes every time.
42 cat tmp/test-multiple | grep -v "It was generated from tmp/test-multiple.m4"
44 # Test multiple arguments with spaces to generate().
45 echo "Test with multiple arguments with spaces passed to generate().
48 " > tmp/test-multiple-spaces.m4
49 generate m4 tmp/test-multiple-spaces -DFIRST="first with spaces" \
50 -DSECOND="second with spaces"
51 # Remove the line with the current date as it changes every time.
52 cat tmp/test-multiple-spaces \
53 | grep -v "It was generated from tmp/test-multiple-spaces.m4"
55 # Test generate() using awk.
56 echo "Simple test fiel for generate() using awk.
59 generate awk tmp/test-awk '{ print $1 }'
60 # Remove the line with the current date as it changes every time.
61 cat tmp/test-awk | grep -v "It was generated from tmp/test-awk.in"
63 # Test generate() using perl.
64 echo "Simple test fiel for generate() using perl.
67 generate perl tmp/test-perl -p -e 's/first/best/'
68 # Remove the line with the current date as it changes every time.
69 cat tmp/test-perl | grep -v "It was generated from tmp/test-perl.in"
71 # Test generate() using cat.
72 echo "Simple test fiel for generate() using cat (simple copy).
76 generate cat tmp/test-cat .real
77 # Remove the line with the current date as it changes every time.
78 cat tmp/test-cat | grep -v "It was generated from tmp/test-cat.real"