Merge branch 'msvc'
[platform/upstream/automake.git] / tests / comment5.test
1 #! /bin/sh
2 # Copyright (C) 2002, 2003, 2010  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 . ./defs || Exit 1
21
22 set -e
23
24 cat >> configure.in <<'EOF'
25 AC_OUTPUT
26 EOF
27
28 cat > Makefile.am << 'EOF'
29 all-local:
30         @echo ${var}
31
32 # a comment with backslash \
33
34
35 var = foo
36 EOF
37
38 $ACLOCAL
39 AUTOMAKE_fails
40 grep '^Makefile.am:5: error: blank line following trailing backslash' stderr
41
42
43 ## Here is a second test because head comments are
44 ## handled differently in Automake 1.5.
45
46 cat > Makefile.am << 'EOF'
47 # a comment with backslash \
48
49
50 all-local:
51         @echo ${var}
52
53 var = foo
54 EOF
55
56 AUTOMAKE_fails
57 grep '^Makefile.am:2: error: blank line following trailing backslash' stderr
58
59
60 ## Make sure we print an 'included' stack on errors.
61
62 echo 'include Makefile.inc'> Makefile.am
63 cat > Makefile.inc << 'EOF'
64 # a comment with backslash \
65
66 EOF
67
68 AUTOMAKE_fails
69 grep '^Makefile.inc:2: error: blank line following trailing backslash' stderr
70 grep '^Makefile.am:1: .*included from here' stderr
71 grep -v '^Makefile.am:1: .*error:' stderr
72
73
74 ## Make sure backslashes are still allowed within a comment.
75 ## This usually happens when commenting out a Makefile rule.
76
77 cat > Makefile.am << 'EOF'
78 all-local:
79         @echo ${var}
80
81 # a comment with backslash \
82 # but terminated by a line without backslash
83
84 var = foo
85 EOF
86
87 $AUTOMAKE