xref: /freebsd/contrib/bmake/unit-tests/varname-dot-newline.mk (revision 924226fba12cc9a228c73b956e1b7fa24c60b055)
1# $NetBSD: varname-dot-newline.mk,v 1.4 2020/10/24 08:46:08 rillig Exp $
2#
3# Tests for the special .newline variable.
4#
5# Contrary to the special variable named "" that is used in expressions like
6# ${:Usome-value}, the variable ".newline" is not protected against
7# modification.  Nobody exploits that though.
8
9NEWLINE:=	${.newline}
10
11.newline=	overwritten
12
13.if ${.newline} == ${NEWLINE}
14.  info The .newline variable cannot be overwritten.  Good.
15.else
16.  info The .newline variable can be overwritten.  Just don't do that.
17.endif
18
19# Restore the original value.
20.newline=	${NEWLINE}
21
22all:
23	@echo 'first${.newline}second'
24