diff options
| author | Simon J. Gerraty <sjg@FreeBSD.org> | 2020-11-20 03:54:37 +0000 |
|---|---|---|
| committer | Simon J. Gerraty <sjg@FreeBSD.org> | 2020-11-20 03:54:37 +0000 |
| commit | 1b65f0bd2bda7121a90f8cb4c1cacaa20f1b681d (patch) | |
| tree | 90c374b8513ec5109e1ec4e2228e2edf648e8756 /unit-tests/cond-token-string.mk | |
| parent | 302da1a3d35c15cb29d76e0a939f8bcb13f7ad80 (diff) | |
Notes
Diffstat (limited to 'unit-tests/cond-token-string.mk')
| -rw-r--r-- | unit-tests/cond-token-string.mk | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/unit-tests/cond-token-string.mk b/unit-tests/cond-token-string.mk index 1a8019754824b..7e110806d4085 100644 --- a/unit-tests/cond-token-string.mk +++ b/unit-tests/cond-token-string.mk @@ -1,8 +1,39 @@ -# $NetBSD: cond-token-string.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $ +# $NetBSD: cond-token-string.mk,v 1.3 2020/11/10 22:23:37 rillig Exp $ # # Tests for quoted and unquoted string literals in .if conditions. # TODO: Implementation +# Cover the code in CondParser_String that frees the memory after parsing +# a variable expression based on an undefined variable. +.if "" != "${:Uvalue:Z}" +. error +.else +. error +.endif + +.if x${:Uvalue} +. error +.else +. info xvalue is not defined. +.endif + +# The 'x' produces a "Malformed conditional" since the left-hand side of a +# comparison in an .if directive must be either a variable expression, a +# quoted string literal or a number that starts with a digit. +.if x${:Uvalue} == "" +. error +.else +. error +.endif + +# In plain words, a '\' can be used to escape any character, just as in +# double-quoted string literals. See CondParser_String. +.if \x${:Uvalue} == "xvalue" +. info Expected. +.else +. error +.endif + all: @:; |
