Module Name:    src
Committed By:   rillig
Date:           Thu Jan 21 13:52:32 UTC 2021

Modified Files:
        src/usr.bin/make/unit-tests: cond-token-plain.exp cond-token-plain.mk

Log Message:
make(1): add test case for bare word containing quotes


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-token-plain.exp
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/cond-token-plain.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-token-plain.exp
diff -u src/usr.bin/make/unit-tests/cond-token-plain.exp:1.5 src/usr.bin/make/unit-tests/cond-token-plain.exp:1.6
--- src/usr.bin/make/unit-tests/cond-token-plain.exp:1.5	Thu Jan 21 13:32:17 2021
+++ src/usr.bin/make/unit-tests/cond-token-plain.exp	Thu Jan 21 13:52:32 2021
@@ -47,6 +47,8 @@ CondParser_Eval: \\
 make: "cond-token-plain.mk" line 163: The variable '\\' is not defined.
 CondParser_Eval: \\
 make: "cond-token-plain.mk" line 168: Now the variable '\\' is defined.
+CondParser_Eval: "unquoted\"quoted" != unquoted"quoted
+lhs = "unquoted"quoted", rhs = "unquoted"quoted", op = !=
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/cond-token-plain.mk
diff -u src/usr.bin/make/unit-tests/cond-token-plain.mk:1.8 src/usr.bin/make/unit-tests/cond-token-plain.mk:1.9
--- src/usr.bin/make/unit-tests/cond-token-plain.mk:1.8	Thu Jan 21 13:32:17 2021
+++ src/usr.bin/make/unit-tests/cond-token-plain.mk	Thu Jan 21 13:52:32 2021
@@ -1,4 +1,4 @@
-# $NetBSD: cond-token-plain.mk,v 1.8 2021/01/21 13:32:17 rillig Exp $
+# $NetBSD: cond-token-plain.mk,v 1.9 2021/01/21 13:52:32 rillig Exp $
 #
 # Tests for plain tokens (that is, string literals without quotes)
 # in .if conditions.
@@ -170,6 +170,13 @@ ${:U\\\\}=	backslash
 .  error
 .endif
 
+# Anything that doesn't start with a double quote is considered a "bare word".
+# Strangely, a bare word may contain double quotes inside.  Nobody should ever
+# depend on this since it may well be unintended.  See CondParser_String.
+.if "unquoted\"quoted" != unquoted"quoted
+.  error
+.endif
+
 # See cond-token-string.mk for similar tests where the condition is enclosed
 # in "quotes".
 

Reply via email to