xref: /freebsd/contrib/bmake/unit-tests/export-variants.mk (revision fe6060f10f634930ff71b7c50291ddc610da2475)
1# $NetBSD: export-variants.mk,v 1.4 2020/10/24 08:46:08 rillig Exp $
2#
3# Test whether exported variables apply to each variant of running
4# external commands:
5#
6# The != assignments.
7# The :!cmd! modifier.
8# The :sh modifier.
9
10SHVAR!=	env | grep ^UT_ || true
11.if ${SHVAR} != ""
12.  warning At this point, no variable should be exported.
13.endif
14
15.if ${:!env | grep ^UT_ || true!} != ""
16.  warning At this point, no variable should be exported.
17.endif
18
19.if ${env | grep ^UT_ || true:L:sh} != ""
20.  warning At this point, no variable should be exported.
21.endif
22
23UT_VAR=		value
24.export UT_VAR
25
26SHVAR!=	env | grep ^UT_ || true
27.if ${SHVAR} != "UT_VAR=value"
28.  warning At this point, a single variable should be exported.
29.endif
30
31.if ${:!env | grep ^UT_ || true!} != "UT_VAR=value"
32.  warning At this point, a single variable should be exported.
33.endif
34
35.if ${env | grep ^UT_ || true:L:sh} != "UT_VAR=value"
36.  warning At this point, a single variable should be exported.
37.endif
38
39all:
40	@:;
41