tests: expose automake bug#14560
[platform/upstream/automake.git] / t / comment5.sh
1 #! /bin/sh
2 # Copyright (C) 2002-2013 Free Software Foundation, Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 # Test for PR/280.
18 # (Automake should complain about trailing backslashes in comments.)
19
20 . test-init.sh
21
22 cat >> configure.ac <<'EOF'
23 AC_OUTPUT
24 EOF
25
26 cat > Makefile.am << 'EOF'
27 all-local:
28         @echo ${var}
29
30 # a comment with backslash \
31
32
33 var = foo
34 EOF
35
36 $ACLOCAL
37 AUTOMAKE_fails
38 grep '^Makefile.am:5: error: blank line following trailing backslash' stderr
39
40
41 ## Here is a second test because head comments are
42 ## handled differently in Automake 1.5.
43
44 cat > Makefile.am << 'EOF'
45 # a comment with backslash \
46
47
48 all-local:
49         @echo ${var}
50
51 var = foo
52 EOF
53
54 AUTOMAKE_fails
55 grep '^Makefile.am:2: error: blank line following trailing backslash' stderr
56
57
58 ## Make sure we print an 'included' stack on errors.
59
60 echo 'include Makefile.inc'> Makefile.am
61 cat > Makefile.inc << 'EOF'
62 # a comment with backslash \
63
64 EOF
65
66 AUTOMAKE_fails
67 grep '^Makefile.inc:2: error: blank line following trailing backslash' stderr
68 grep '^Makefile.am:1: .*included from here' stderr
69 grep -v '^Makefile.am:1: .*error:' stderr
70
71
72 ## Make sure backslashes are still allowed within a comment.
73 ## This usually happens when commenting out a Makefile rule.
74
75 cat > Makefile.am << 'EOF'
76 all-local:
77         @echo ${var}
78
79 # a comment with backslash \
80 # but terminated by a line without backslash
81
82 var = foo
83 EOF
84
85 $AUTOMAKE