comment5.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #! /bin/sh
  2. # Copyright (C) 2002-2017 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. # Test for PR/280.
  17. # (Automake should complain about trailing backslashes in comments.)
  18. . test-init.sh
  19. cat >> configure.ac <<'EOF'
  20. AC_OUTPUT
  21. EOF
  22. cat > Makefile.am << 'EOF'
  23. all-local:
  24. @echo ${var}
  25. # a comment with backslash \
  26. var = foo
  27. EOF
  28. $ACLOCAL
  29. AUTOMAKE_fails
  30. grep '^Makefile.am:5: error: blank line following trailing backslash' stderr
  31. ## Here is a second test because head comments are
  32. ## handled differently in Automake 1.5.
  33. cat > Makefile.am << 'EOF'
  34. # a comment with backslash \
  35. all-local:
  36. @echo ${var}
  37. var = foo
  38. EOF
  39. AUTOMAKE_fails
  40. grep '^Makefile.am:2: error: blank line following trailing backslash' stderr
  41. ## Make sure we print an 'included' stack on errors.
  42. echo 'include Makefile.inc'> Makefile.am
  43. cat > Makefile.inc << 'EOF'
  44. # a comment with backslash \
  45. EOF
  46. AUTOMAKE_fails
  47. grep '^Makefile.inc:2: error: blank line following trailing backslash' stderr
  48. grep '^Makefile.am:1: .*included from here' stderr
  49. grep -v '^Makefile.am:1: .*error:' stderr
  50. ## Make sure backslashes are still allowed within a comment.
  51. ## This usually happens when commenting out a Makefile rule.
  52. cat > Makefile.am << 'EOF'
  53. all-local:
  54. @echo ${var}
  55. # a comment with backslash \
  56. # but terminated by a line without backslash
  57. var = foo
  58. EOF
  59. $AUTOMAKE