Module Name: src
Committed By: rillig
Date: Tue Sep 27 19:18:45 UTC 2022
Modified Files:
src/usr.bin/make/unit-tests: var-scope-local-legacy.exp
var-scope-local-legacy.mk varmod-order-numeric.mk
Log Message:
tests/make: add tests for legacy local variables and sorting
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/usr.bin/make/unit-tests/var-scope-local-legacy.exp \
src/usr.bin/make/unit-tests/var-scope-local-legacy.mk
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-order-numeric.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/var-scope-local-legacy.exp
diff -u src/usr.bin/make/unit-tests/var-scope-local-legacy.exp:1.1 src/usr.bin/make/unit-tests/var-scope-local-legacy.exp:1.2
--- src/usr.bin/make/unit-tests/var-scope-local-legacy.exp:1.1 Sun Jan 23 16:25:54 2022
+++ src/usr.bin/make/unit-tests/var-scope-local-legacy.exp Tue Sep 27 19:18:45 2022
@@ -1 +1,6 @@
+: LEN4=undef_
+: XY=undef_
+: AF=undef_
+: %D=undef_ %F=undef_
+: @D=._ @F=all_
exit status 0
Index: src/usr.bin/make/unit-tests/var-scope-local-legacy.mk
diff -u src/usr.bin/make/unit-tests/var-scope-local-legacy.mk:1.1 src/usr.bin/make/unit-tests/var-scope-local-legacy.mk:1.2
--- src/usr.bin/make/unit-tests/var-scope-local-legacy.mk:1.1 Sun Jan 23 16:25:54 2022
+++ src/usr.bin/make/unit-tests/var-scope-local-legacy.mk Tue Sep 27 19:18:45 2022
@@ -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}_
Index: src/usr.bin/make/unit-tests/varmod-order-numeric.mk
diff -u src/usr.bin/make/unit-tests/varmod-order-numeric.mk:1.7 src/usr.bin/make/unit-tests/varmod-order-numeric.mk:1.8
--- src/usr.bin/make/unit-tests/varmod-order-numeric.mk:1.7 Wed Feb 9 21:09:24 2022
+++ src/usr.bin/make/unit-tests/varmod-order-numeric.mk Tue Sep 27 19:18:45 2022
@@ -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 @@ MIXED_BASE= 0 010 0x7 9
. 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: