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 make(1): demonstrate inconsistent :t...
details: https://anonhg.NetBSD.org/src/rev/44b9d8c9efe2
branches: trunk
changeset: 936096:44b9d8c9efe2
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jul 19 07:08:09 2020 +0000
description:
make(1): demonstrate inconsistent :ts behavior among modifiers
diffstat:
usr.bin/make/unit-tests/modts.exp | 5 +++++
usr.bin/make/unit-tests/modts.mk | 18 +++++++++++++++++-
2 files changed, 22 insertions(+), 1 deletions(-)
diffs (45 lines):
diff -r ed1ee2421936 -r 44b9d8c9efe2 usr.bin/make/unit-tests/modts.exp
--- a/usr.bin/make/unit-tests/modts.exp Sun Jul 19 06:56:09 2020 +0000
+++ b/usr.bin/make/unit-tests/modts.exp Sun Jul 19 07:08:09 2020 +0000
@@ -36,4 +36,9 @@
FU_mod-ts="a/b/cool"
FU_mod-ts:ts:T="cool" == cool?
B.${AAA:ts}="Baaa" == Baaa?
+:ts :S => aaxBbxaaxbbxaaxbb
+:ts :S space => axa a axc
+:ts :S space :M => axaxaxaxc
+:ts :S => axa a axc
+:ts :S :@ => axa a axc
exit status 0
diff -r ed1ee2421936 -r 44b9d8c9efe2 usr.bin/make/unit-tests/modts.mk
--- a/usr.bin/make/unit-tests/modts.mk Sun Jul 19 06:56:09 2020 +0000
+++ b/usr.bin/make/unit-tests/modts.mk Sun Jul 19 07:08:09 2020 +0000
@@ -7,7 +7,7 @@
AAA= a a a
B.aaa= Baaa
-all: mod-ts
+all: mod-ts mod-ts-space
# Use print or printf iff they are builtin.
# XXX note that this causes problems, when make decides
@@ -42,3 +42,19 @@
@${PRINT} 'FU_$@="${FU_${@:ts}:ts}"'
@${PRINT} 'FU_$@:ts:T="${FU_${@:ts}:ts:T}" == cool?'
@${PRINT} 'B.$${AAA:ts}="${B.${AAA:ts}}" == Baaa?'
+
+mod-ts-space:
+ # After the :ts modifier, the whole string is interpreted as a single
+ # word since all spaces have been replaced with x.
+ @${PRINT} ':ts :S => '${aa bb aa bb aa bb:L:tsx:S,b,B,:Q}
+
+ # The :ts modifier also applies to word separators that are added
+ # afterwards.
+ @${PRINT} ':ts :S space => '${a ababa c:L:tsx:S,b, ,g:Q}
+ @${PRINT} ':ts :S space :M => '${a ababa c:L:tsx:S,b, ,g:M*:Q}
+
+ # Not all modifiers behave this way though. Some of them always use
+ # a space as word separator instead of the :ts separator.
+ # This seems like an oversight during implementation.
+ @${PRINT} ':ts :S => '${a ababa c:L:tsx:S,b, ,g:Q}
+ @${PRINT} ':ts :S :@ => '${a ababa c:L:tsx:S,b, ,g:@v@${v}@:Q}
Home |
Main Index |
Thread Index |
Old Index