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 tests/make: test function names with...
details: https://anonhg.NetBSD.org/src/rev/27c4e52215e5
branches: trunk
changeset: 1029267:27c4e52215e5
user: rillig <rillig%NetBSD.org@localhost>
date: Tue Dec 28 22:13:56 2021 +0000
description:
tests/make: test function names without following '('
diffstat:
usr.bin/make/unit-tests/cond-func-empty.mk | 17 ++++++++++++++---
usr.bin/make/unit-tests/cond-func.mk | 13 +++++--------
2 files changed, 19 insertions(+), 11 deletions(-)
diffs (66 lines):
diff -r 9e7865f51c27 -r 27c4e52215e5 usr.bin/make/unit-tests/cond-func-empty.mk
--- a/usr.bin/make/unit-tests/cond-func-empty.mk Tue Dec 28 21:56:13 2021 +0000
+++ b/usr.bin/make/unit-tests/cond-func-empty.mk Tue Dec 28 22:13:56 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cond-func-empty.mk,v 1.16 2021/12/11 10:41:31 rillig Exp $
+# $NetBSD: cond-func-empty.mk,v 1.17 2021/12/28 22:13:56 rillig Exp $
#
# Tests for the empty() function in .if conditions, which tests a variable
# expression for emptiness.
@@ -189,5 +189,16 @@
.if defined(VARNAME${:U2}) && !empty(VARNAME${:U2})
.endif
-all:
- @:;
+
+# If the word 'empty' is not followed by '(', it is not a function call but an
+# ordinary bare word. This bare word is interpreted as 'defined(empty)', and
+# since there is no variable named 'empty', the condition evaluates to false.
+.if empty
+. error
+.endif
+
+empty= # defined but empty
+.if empty
+.else
+. error
+.endif
diff -r 9e7865f51c27 -r 27c4e52215e5 usr.bin/make/unit-tests/cond-func.mk
--- a/usr.bin/make/unit-tests/cond-func.mk Tue Dec 28 21:56:13 2021 +0000
+++ b/usr.bin/make/unit-tests/cond-func.mk Tue Dec 28 22:13:56 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cond-func.mk,v 1.9 2020/11/15 14:07:53 rillig Exp $
+# $NetBSD: cond-func.mk,v 1.10 2021/12/28 22:13:56 rillig Exp $
#
# Tests for those parts of the functions in .if conditions that are common
# among several functions.
@@ -102,9 +102,9 @@
. info A plain function name is parsed as !empty(...).
.endif
-# If a variable named 'defined' is actually defined and not empty, the plain
-# symbol 'defined' evaluates to true.
-defined= non-empty
+# If a variable named 'defined' is actually defined, the bare word 'defined'
+# is interpreted as 'defined(defined)', and the condition evaluates to true.
+defined= # defined but empty
.if defined
. info A plain function name is parsed as !empty(...).
.else
@@ -119,7 +119,7 @@
. info Symbols may start with a function name.
.endif
-defined-var= non-empty
+defined-var= # defined but empty
.if defined-var
. info Symbols may start with a function name.
.else
@@ -132,6 +132,3 @@
.else
. error
.endif
-
-all:
- @:;
Home |
Main Index |
Thread Index |
Old Index