aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/unit-tests/cond-token-string.mk
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2021-02-11 06:01:59 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2021-02-11 06:03:22 +0000
commitdba7b0ef928af88caa38728a73657b837aeeac93 (patch)
treefd78de6458efc1c445f9de477bfbd0565dcf5f8b /contrib/bmake/unit-tests/cond-token-string.mk
parent2a7d4d95450429a0d08232a5019a592c47955de3 (diff)
parent8b6f73e37baf5c37946844ec335a84856b1a9033 (diff)
downloadsrc-dba7b0ef928af88caa38728a73657b837aeeac93.tar.gz
src-dba7b0ef928af88caa38728a73657b837aeeac93.zip
Merge bmake-20210206
Changes of interest o unit-tests: use private TMPDIR to avoid errors from other users o avoid strdup in mkTempFile o always use vfork o job.c: do not create empty shell files in jobs mode reduce unnecessary calls to waitpid o cond.c: fix debug output for comparison operators in conditionals
Diffstat (limited to 'contrib/bmake/unit-tests/cond-token-string.mk')
-rw-r--r--contrib/bmake/unit-tests/cond-token-string.mk47
1 files changed, 45 insertions, 2 deletions
diff --git a/contrib/bmake/unit-tests/cond-token-string.mk b/contrib/bmake/unit-tests/cond-token-string.mk
index 7e110806d408..a92d3a896116 100644
--- a/contrib/bmake/unit-tests/cond-token-string.mk
+++ b/contrib/bmake/unit-tests/cond-token-string.mk
@@ -1,6 +1,10 @@
-# $NetBSD: cond-token-string.mk,v 1.3 2020/11/10 22:23:37 rillig Exp $
+# $NetBSD: cond-token-string.mk,v 1.4 2021/01/21 00:38:28 rillig Exp $
#
-# Tests for quoted and unquoted string literals in .if conditions.
+# Tests for quoted string literals in .if conditions.
+#
+# See also:
+# cond-token-plain.mk
+# Covers string literals without quotes (called "bare words").
# TODO: Implementation
@@ -35,5 +39,44 @@
. error
.endif
+.MAKEFLAGS: -dc
+
+# A string in quotes is checked whether it is not empty.
+.if "UNDEF"
+. info The string literal "UNDEF" is not empty.
+.else
+. error
+.endif
+
+# A space is not empty as well.
+# This differs from many other places where whitespace is trimmed.
+.if " "
+. info The string literal " " is not empty, even though it consists of $\
+ whitespace only.
+.else
+. error
+.endif
+
+.if "${UNDEF}"
+. error
+.else
+. info An undefined variable in quotes expands to an empty string, which $\
+ then evaluates to false.
+.endif
+
+.if "${:Uvalue}"
+. info A nonempty variable expression evaluates to true.
+.else
+. error
+.endif
+
+.if "${:U}"
+. error
+.else
+. info An empty variable evaluates to false.
+.endif
+
+.MAKEFLAGS: -d0
+
all:
@:;