Module Name: src Committed By: rillig Date: Fri Aug 28 14:07:51 UTC 2020
Modified Files: src/usr.bin/make/unit-tests: cond-op.exp cond-op.mk Log Message: make(1): add test for unquoted string literals To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cond-op.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cond-op.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/unit-tests/cond-op.exp diff -u src/usr.bin/make/unit-tests/cond-op.exp:1.1 src/usr.bin/make/unit-tests/cond-op.exp:1.2 --- src/usr.bin/make/unit-tests/cond-op.exp:1.1 Sun Aug 16 12:07:51 2020 +++ src/usr.bin/make/unit-tests/cond-op.exp Fri Aug 28 14:07:51 2020 @@ -1 +1,5 @@ -exit status 0 +make: "cond-op.mk" line 45: Malformed conditional ("!word" == !word) +make: "cond-op.mk" line 57: Parsing continues until here. +make: Fatal errors encountered -- cannot continue +make: stopped in unit-tests +exit status 1 Index: src/usr.bin/make/unit-tests/cond-op.mk diff -u src/usr.bin/make/unit-tests/cond-op.mk:1.3 src/usr.bin/make/unit-tests/cond-op.mk:1.4 --- src/usr.bin/make/unit-tests/cond-op.mk:1.3 Fri Aug 28 13:50:48 2020 +++ src/usr.bin/make/unit-tests/cond-op.mk Fri Aug 28 14:07:51 2020 @@ -1,4 +1,4 @@ -# $NetBSD: cond-op.mk,v 1.3 2020/08/28 13:50:48 rillig Exp $ +# $NetBSD: cond-op.mk,v 1.4 2020/08/28 14:07:51 rillig Exp $ # # Tests for operators like &&, ||, ! in .if conditions. # @@ -38,5 +38,23 @@ # makes a difference. There is a simple example for sure, I just cannot # wrap my head around it. +# This condition is malformed because the '!' on the right-hand side must not +# appear unquoted. If any, it must be enclosed in quotes. +# In any case, it is not interpreted as a negation of an unquoted string. +# See CondGetString. +.if "!word" == !word +.error +.endif + +# Surprisingly, the ampersand and pipe are allowed in bare strings. +# That's another opportunity for writing confusing code. +# See CondGetString, which only has '!' in the list of stop characters. +.if "a&&b||c" != a&&b||c +.error +.endif + +# Just in case that parsing should ever stop on the first error. +.info Parsing continues until here. + all: @:;