diff options
author | rillig <rillig@pkgsrc.org> | 2020-05-06 06:14:56 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2020-05-06 06:14:56 +0000 |
commit | 8b962bcad28a5e5c404e62b89fab499e9cd3850d (patch) | |
tree | 04598f112ee691f52184f24af33c500c10b55a55 /regress | |
parent | badd054e73c98fb6252b9fdb57ab58de6170b95a (diff) | |
download | pkgsrc-8b962bcad28a5e5c404e62b89fab499e9cd3850d.tar.gz |
mk/subst.mk: allow identity substitutions with escaped dots
This fixes the build of converters/help2man in SUBST_NOOP_OK=no mode.
Diffstat (limited to 'regress')
-rw-r--r-- | regress/infra-unittests/subst.sh | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/regress/infra-unittests/subst.sh b/regress/infra-unittests/subst.sh index ee404ee1508..5a06aadacf2 100644 --- a/regress/infra-unittests/subst.sh +++ b/regress/infra-unittests/subst.sh @@ -1,5 +1,5 @@ #! /bin/sh -# $NetBSD: subst.sh,v 1.31 2020/05/02 06:48:59 rillig Exp $ +# $NetBSD: subst.sh,v 1.32 2020/05/06 06:14:56 rillig Exp $ # # Tests for mk/subst.mk. # @@ -1189,6 +1189,29 @@ if test_case_begin "identity substitution implementation"; then specials='!"%'\''()+,-/:;<=>@_`{|}~' assert_identity "yes" -e "sX${specials}X${specials}X" + # Regular expression meta-characters may be escaped using a + # backslash or be enclosed in square brackets. + assert_identity 'yes' -e 's,library\.so,library.so,g' + assert_identity 'yes' -e 's,library[.]so,library.so,g' + assert_identity 'yes' -e 's,[*],*,' + assert_identity 'yes' -e 's,[$],$,' + + # When this happens, it is probably a mistake. + assert_identity 'no' -e 's,,,' + + # Backslashes are not considered identity substitutions since + # there might be tricky corner cases. + assert_identity 'no' -e 's,\\,\\,' + + # Back-references are not considered identity substitutions. + assert_identity 'no' -e 's,\1,\1,' + + # The & is interpreted specially in the replacement string. + assert_identity 'no' -e 's,&&&,&&&,' + assert_identity 'no' -e 's,\&,&,' + assert_identity 'no' -e 's,[&],&,' + assert_identity 'no' -e 's,&,\&,' # this would be an identity + test_case_end fi |