Module Name:    src
Committed By:   rillig
Date:           Sat Dec  5 18:13:44 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: varmod-subst-regex.exp
            varmod-subst-regex.mk

Log Message:
make(1): add test for unknown modifier in :C modifier replacement


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-subst-regex.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-subst-regex.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/varmod-subst-regex.exp
diff -u src/usr.bin/make/unit-tests/varmod-subst-regex.exp:1.3 src/usr.bin/make/unit-tests/varmod-subst-regex.exp:1.4
--- src/usr.bin/make/unit-tests/varmod-subst-regex.exp:1.3	Fri Aug 28 17:15:04 2020
+++ src/usr.bin/make/unit-tests/varmod-subst-regex.exp	Sat Dec  5 18:13:44 2020
@@ -20,4 +20,6 @@ mod-regex-limits:22-ok:1 33 556
 mod-regex-limits:capture:ihgfedcbaabcdefghijABCDEFGHIJa0a1a2rest
 make: Regex compilation error: (details omitted)
 mod-regex-errors:
+make: Unknown modifier 'Z'
+mod-regex-errors: xy
 exit status 0

Index: src/usr.bin/make/unit-tests/varmod-subst-regex.mk
diff -u src/usr.bin/make/unit-tests/varmod-subst-regex.mk:1.5 src/usr.bin/make/unit-tests/varmod-subst-regex.mk:1.6
--- src/usr.bin/make/unit-tests/varmod-subst-regex.mk:1.5	Sat Oct 31 12:20:36 2020
+++ src/usr.bin/make/unit-tests/varmod-subst-regex.mk	Sat Dec  5 18:13:44 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-subst-regex.mk,v 1.5 2020/10/31 12:20:36 rillig Exp $
+# $NetBSD: varmod-subst-regex.mk,v 1.6 2020/12/05 18:13:44 rillig Exp $
 #
 # Tests for the :C,from,to, variable modifier.
 
@@ -102,3 +102,8 @@ mod-regex-limits:
 
 mod-regex-errors:
 	@echo $@: ${UNDEF:Uvalue:C,[,,}
+
+	# If the replacement pattern produces a parse error because of an
+	# unknown modifier, the parse error is ignored in ParseModifierPart
+	# and the faulty variable expression expands to "".
+	@echo $@: ${word:L:C,.*,x${:U:Z}y,W}

Reply via email to