Module Name: src Committed By: rillig Date: Sun Sep 13 05:36:26 UTC 2020
Modified Files: src/usr.bin/make/unit-tests: varmod-match.mk Log Message: make(1): fix comments in test for the :M variable modifier One mistake per sentence is pretty much, I must have been quite unconcentrated. The other commits from around that time are fine though. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varmod-match.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-match.mk diff -u src/usr.bin/make/unit-tests/varmod-match.mk:1.4 src/usr.bin/make/unit-tests/varmod-match.mk:1.5 --- src/usr.bin/make/unit-tests/varmod-match.mk:1.4 Sat Sep 12 22:35:43 2020 +++ src/usr.bin/make/unit-tests/varmod-match.mk Sun Sep 13 05:36:26 2020 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-match.mk,v 1.4 2020/09/12 22:35:43 rillig Exp $ +# $NetBSD: varmod-match.mk,v 1.5 2020/09/13 05:36:26 rillig Exp $ # # Tests for the :M variable modifier, which filters words that match the # given pattern. @@ -9,18 +9,21 @@ NUMBERS= One Two Three Four five six seven -# Only keep numbers that start with an uppercase letter. +# Only keep words that start with an uppercase letter. .if ${NUMBERS:M[A-Z]*} != "One Two Three Four" . error .endif -# Only keep numbers that don't start with an uppercase letter. +# Only keep words that start with a character other than an uppercase letter. .if ${NUMBERS:M[^A-Z]*} != "five six seven" . error .endif -# Only keep numbers that don't start with s and at the same time -# ends with either of [ex]. +# Only keep words that don't start with s and at the same time end with +# either of [ex]. +# +# This test case ensures that the negation from the first character class +# does not propagate to the second character class. .if ${NUMBERS:M[^s]*[ex]} != "One Three five" . error .endif @@ -31,14 +34,18 @@ NUMBERS= One Two Three Four five six sev .endif # To match a dollar sign in a word, double it. +# # This is different from the :S and :C variable modifiers, where a '$' -# has to be escaped as '$$'. +# has to be escaped as '\$'. .if ${:Ua \$ sign:M*$$*} != "\$" . error .endif -# In the :M modifier, it does not work to escape a dollar using a backslash. -# This is different from the :S, :C and a few other variable modifiers. +# In the :M modifier, '\$' does not escape a dollar. Instead it is +# interpreted as a backslash followed by whatever expression the +# '$' starts. +# +# This differs from the :S, :C and several other variable modifiers. ${:U*}= asterisk .if ${:Ua \$ sign any-asterisk:M*\$*} != "any-asterisk" . error