]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/bmake/unit-tests/cond-token-string.mk
Merge bmake-20201117
[FreeBSD/FreeBSD.git] / contrib / bmake / unit-tests / cond-token-string.mk
1 # $NetBSD: cond-token-string.mk,v 1.3 2020/11/10 22:23:37 rillig Exp $
2 #
3 # Tests for quoted and unquoted string literals in .if conditions.
4
5 # TODO: Implementation
6
7 # Cover the code in CondParser_String that frees the memory after parsing
8 # a variable expression based on an undefined variable.
9 .if "" != "${:Uvalue:Z}"
10 .  error
11 .else
12 .  error
13 .endif
14
15 .if x${:Uvalue}
16 .  error
17 .else
18 .  info xvalue is not defined.
19 .endif
20
21 # The 'x' produces a "Malformed conditional" since the left-hand side of a
22 # comparison in an .if directive must be either a variable expression, a
23 # quoted string literal or a number that starts with a digit.
24 .if x${:Uvalue} == ""
25 .  error
26 .else
27 .  error
28 .endif
29
30 # In plain words, a '\' can be used to escape any character, just as in
31 # double-quoted string literals.  See CondParser_String.
32 .if \x${:Uvalue} == "xvalue"
33 .  info Expected.
34 .else
35 .  error
36 .endif
37
38 all:
39         @:;