xref: /freebsd/contrib/bmake/unit-tests/varname-dot-newline.mk (revision a96ef4501919d7ac08e94e98dc34b0bdd744802b)
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