aboutsummaryrefslogtreecommitdiff
path: root/unit-tests/cond-token-var.mk
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2020-09-05 16:11:04 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2020-09-05 16:11:04 +0000
commit6bbc783f48498b808e19db4441299dc7d85a278b (patch)
treebe201219a56594c76537191ee91fdd3ef8cfb348 /unit-tests/cond-token-var.mk
parent367d32e2b15fe0397ddecccaa04cf9ed0164c969 (diff)
downloadsrc-6bbc783f48498b808e19db4441299dc7d85a278b.tar.gz
src-6bbc783f48498b808e19db4441299dc7d85a278b.zip
Notes
Diffstat (limited to 'unit-tests/cond-token-var.mk')
-rw-r--r--unit-tests/cond-token-var.mk34
1 files changed, 34 insertions, 0 deletions
diff --git a/unit-tests/cond-token-var.mk b/unit-tests/cond-token-var.mk
new file mode 100644
index 000000000000..5d5bbf2c7fc4
--- /dev/null
+++ b/unit-tests/cond-token-var.mk
@@ -0,0 +1,34 @@
+# $NetBSD: cond-token-var.mk,v 1.3 2020/08/20 19:43:42 rillig Exp $
+#
+# Tests for variables in .if conditions.
+
+DEF= defined
+
+# A defined variable may appear on either side of the comparison.
+.if ${DEF} == ${DEF}
+.info ok
+.else
+.error
+.endif
+
+# A variable that appears on the left-hand side must be defined.
+.if ${UNDEF} == ${DEF}
+.error
+.endif
+
+# A variable that appears on the right-hand side must be defined.
+.if ${DEF} == ${UNDEF}
+.error
+.endif
+
+# A defined variable may appear as an expression of its own.
+.if ${DEF}
+.endif
+
+# An undefined variable generates a warning.
+.if ${UNDEF}
+.endif
+
+# The :U modifier turns an undefined variable into an ordinary expression.
+.if ${UNDEF:U}
+.endif