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: add tests for legacy loc...
details: https://anonhg.NetBSD.org/src/rev/494089a9a1be
branches: trunk
changeset: 371189:494089a9a1be
user: rillig <rillig%NetBSD.org@localhost>
date: Tue Sep 27 19:18:45 2022 +0000
description:
tests/make: add tests for legacy local variables and sorting
diffstat:
usr.bin/make/unit-tests/var-scope-local-legacy.exp | 5 +++++
usr.bin/make/unit-tests/var-scope-local-legacy.mk | 19 ++++++++++++++-----
usr.bin/make/unit-tests/varmod-order-numeric.mk | 8 +++++++-
3 files changed, 26 insertions(+), 6 deletions(-)
diffs (56 lines):
diff -r b77a0b7f1921 -r 494089a9a1be usr.bin/make/unit-tests/var-scope-local-legacy.exp
--- a/usr.bin/make/unit-tests/var-scope-local-legacy.exp Tue Sep 27 17:46:58 2022 +0000
+++ b/usr.bin/make/unit-tests/var-scope-local-legacy.exp Tue Sep 27 19:18:45 2022 +0000
@@ -1,1 +1,6 @@
+: LEN4=undef_
+: XY=undef_
+: AF=undef_
+: %D=undef_ %F=undef_
+: @D=._ @F=all_
exit status 0
diff -r b77a0b7f1921 -r 494089a9a1be usr.bin/make/unit-tests/var-scope-local-legacy.mk
--- a/usr.bin/make/unit-tests/var-scope-local-legacy.mk Tue Sep 27 17:46:58 2022 +0000
+++ b/usr.bin/make/unit-tests/var-scope-local-legacy.mk Tue Sep 27 19:18:45 2022 +0000
@@ -1,8 +1,17 @@
-# $NetBSD: var-scope-local-legacy.mk,v 1.1 2022/01/23 16:25:54 rillig Exp $
+# $NetBSD: var-scope-local-legacy.mk,v 1.2 2022/09/27 19:18:45 rillig Exp $
#
# Tests for legacy target-local variables, such as ${<F} or ${@D}.
-# TODO: Implementation
-
-all:
- @:;
+all: .PHONY
+ # Only variables of length 2 can be legacy, this one cannot.
+ : LEN4=${LEN4:Uundef}_
+ # The second character of the name must be 'D' or 'F'.
+ : XY=${XY:Uundef}_
+ # The first character must name one of the 7 predefined local
+ # variables, 'A' is not such a character.
+ : AF=${AF:Uundef}_
+ # The variable '.MEMBER' is undefined, therefore '%D' and '%F' are
+ # undefined as well.
+ : %D=${%D:Uundef}_ %F=${%F:Uundef}_
+ # The directory name of the target is '.', its basename is 'all'.
+ : @D=${@D:Uundef}_ @F=${@F:Uundef}_
diff -r b77a0b7f1921 -r 494089a9a1be usr.bin/make/unit-tests/varmod-order-numeric.mk
--- a/usr.bin/make/unit-tests/varmod-order-numeric.mk Tue Sep 27 17:46:58 2022 +0000
+++ b/usr.bin/make/unit-tests/varmod-order-numeric.mk Tue Sep 27 19:18:45 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-order-numeric.mk,v 1.7 2022/02/09 21:09:24 rillig Exp $
+# $NetBSD: varmod-order-numeric.mk,v 1.8 2022/09/27 19:18:45 rillig Exp $
#
# Tests for the variable modifiers ':On', which returns the words, sorted in
# ascending numeric order, and for ':Orn' and ':Onr', which additionally
@@ -50,4 +50,10 @@
. error ${MIXED_BASE:On}
.endif
+# The measurement units for suffixes are k, M, G, but not T.
+# The string '3T' evaluates to 3, the string 'x' evaluates as '0'.
+.if ${4 3T 2M x:L:On} != "x 3T 4 2M"
+. error
+.endif
+
all:
Home |
Main Index |
Thread Index |
Old Index