diff --git a/usr.bin/make/unit-tests/cond-cmp-string.exp b/usr.bin/make/unit-tests/cond-cmp-string.exp index 735b7cda4430..861af9c51e5d 100644 --- a/usr.bin/make/unit-tests/cond-cmp-string.exp +++ b/usr.bin/make/unit-tests/cond-cmp-string.exp @@ -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 diff --git a/usr.bin/make/unit-tests/cond-cmp-string.mk b/usr.bin/make/unit-tests/cond-cmp-string.mk index 034fe2a34405..01a3b11613f9 100644 --- a/usr.bin/make/unit-tests/cond-cmp-string.mk +++ b/usr.bin/make/unit-tests/cond-cmp-string.mk @@ -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