1 # $NetBSD: cond-token-string.mk,v 1.4 2021/01/21 00:38:28 rillig Exp $
3 # Tests for quoted string literals in .if conditions.
7 # Covers string literals without quotes (called "bare words").
11 # Cover the code in CondParser_String that frees the memory after parsing
12 # a variable expression based on an undefined variable.
13 .if "" != "${:Uvalue:Z}"
22 . info xvalue is not defined.
25 # The 'x' produces a "Malformed conditional" since the left-hand side of a
26 # comparison in an .if directive must be either a variable expression, a
27 # quoted string literal or a number that starts with a digit.
34 # In plain words, a '\' can be used to escape any character, just as in
35 # double-quoted string literals. See CondParser_String.
36 .if \x${:Uvalue} == "xvalue"
44 # A string in quotes is checked whether it is not empty.
46 . info The string literal "UNDEF" is not empty.
51 # A space is not empty as well.
52 # This differs from many other places where whitespace is trimmed.
54 . info The string literal " " is not empty, even though it consists of $\
63 . info An undefined variable in quotes expands to an empty string, which $\
64 then evaluates to false.
68 . info A nonempty variable expression evaluates to true.
76 . info An empty variable evaluates to false.