make(1): demonstrate parse error in string interpolation in condition
This commit is contained in:
parent
c743b1bd9f
commit
9b4bcdd1d9
@ -3,6 +3,7 @@ make: "cond-cmp-string.mk" line 37: Malformed conditional ("string" != "str""ing
|
||||
make: "cond-cmp-string.mk" line 42: warning: String comparison operator must be either == or !=
|
||||
make: "cond-cmp-string.mk" line 42: Malformed conditional (!("value" = "value"))
|
||||
make: "cond-cmp-string.mk" line 49: Malformed conditional (!("value" === "value"))
|
||||
make: "cond-cmp-string.mk" line 63: Malformed conditional (${:Uword} != "${:Uword} ")
|
||||
make: Fatal errors encountered -- cannot continue
|
||||
make: stopped in unit-tests
|
||||
exit status 1
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: cond-cmp-string.mk,v 1.6 2020/10/24 08:46:08 rillig Exp $
|
||||
# $NetBSD: cond-cmp-string.mk,v 1.7 2020/10/30 08:13:17 rillig Exp $
|
||||
#
|
||||
# Tests for string comparisons in .if conditions.
|
||||
|
||||
@ -52,3 +52,22 @@
|
||||
. error
|
||||
.endif
|
||||
|
||||
# A variable expression can be enclosed in double quotes.
|
||||
.if ${:Uword} != "${:Uword}"
|
||||
. error
|
||||
.endif
|
||||
|
||||
# XXX: As of 2020-10-30, adding a space to the string results in a parse
|
||||
# error. This is a bug and should have been caught much earlier.
|
||||
# I wonder since when it exists.
|
||||
.if ${:Uword} != "${:Uword} "
|
||||
. error
|
||||
.else
|
||||
. error
|
||||
.endif
|
||||
|
||||
# Adding a space at the beginning of the quoted variable expression works
|
||||
# though.
|
||||
.if ${:U word } != " ${:Uword} "
|
||||
. error
|
||||
.endif
|
||||
|
Loading…
Reference in New Issue
Block a user