diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-11 08:21:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-11 08:21:29 +0000 |
commit | 29cd838eab01ed7110f3ccb2e8c6a35c8a31dbcc (patch) | |
tree | 63ef546b10a81d461e5cf5ed9e98a68cd7dee1aa /src/kmk/tests/scripts/functions/substitution | |
parent | Initial commit. (diff) | |
download | kbuild-29cd838eab01ed7110f3ccb2e8c6a35c8a31dbcc.tar.xz kbuild-29cd838eab01ed7110f3ccb2e8c6a35c8a31dbcc.zip |
Adding upstream version 1:0.1.9998svn3589+dfsg.upstream/1%0.1.9998svn3589+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/kmk/tests/scripts/functions/substitution')
-rw-r--r-- | src/kmk/tests/scripts/functions/substitution | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/kmk/tests/scripts/functions/substitution b/src/kmk/tests/scripts/functions/substitution new file mode 100644 index 0000000..0d2f6a2 --- /dev/null +++ b/src/kmk/tests/scripts/functions/substitution @@ -0,0 +1,38 @@ +# -*-perl-*- + +$description = "Test the subst and patsubst functions"; + +$details = ""; + +# Generic patsubst test: test both the function and variable form. + +run_make_test(' +foo := a.o b.o c.o +bar := $(foo:.o=.c) +bar2:= $(foo:%.o=%.c) +bar3:= $(patsubst %.c,%.o,x.c.c bar.c) +all:;@echo $(bar); echo $(bar2); echo $(bar3)', +'', +'a.c b.c c.c +a.c b.c c.c +x.c.o bar.o'); + +# Patsubst without '%'--shouldn't match because the whole word has to match +# in patsubst. Based on a bug report by Markus Mauhart <qwe123@chello.at> + +run_make_test('all:;@echo $(patsubst Foo,Repl,FooFoo)', '', 'FooFoo'); + +# Variable subst where a pattern matches multiple times in a single word. +# Based on a bug report by Markus Mauhart <qwe123@chello.at> + +run_make_test(' +A := fooBARfooBARfoo +all:;@echo $(A:fooBARfoo=REPL)', '', 'fooBARREPL'); + +1; + + + + + + |