Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make/unit-tests make(1): add test case for bare word...
details: https://anonhg.NetBSD.org/src/rev/b582d9481055
branches: trunk
changeset: 950218:b582d9481055
user: rillig <rillig%NetBSD.org@localhost>
date: Thu Jan 21 13:52:32 2021 +0000
description:
make(1): add test case for bare word containing quotes
diffstat:
usr.bin/make/unit-tests/cond-token-plain.exp | 2 ++
usr.bin/make/unit-tests/cond-token-plain.mk | 9 ++++++++-
2 files changed, 10 insertions(+), 1 deletions(-)
diffs (35 lines):
diff -r f0122e71f1a8 -r b582d9481055 usr.bin/make/unit-tests/cond-token-plain.exp
--- a/usr.bin/make/unit-tests/cond-token-plain.exp Thu Jan 21 13:51:24 2021 +0000
+++ b/usr.bin/make/unit-tests/cond-token-plain.exp Thu Jan 21 13:52:32 2021 +0000
@@ -47,6 +47,8 @@
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
diff -r f0122e71f1a8 -r b582d9481055 usr.bin/make/unit-tests/cond-token-plain.mk
--- a/usr.bin/make/unit-tests/cond-token-plain.mk Thu Jan 21 13:51:24 2021 +0000
+++ b/usr.bin/make/unit-tests/cond-token-plain.mk Thu Jan 21 13:52:32 2021 +0000
@@ -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 @@
. 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".
Home |
Main Index |
Thread Index |
Old Index