1#                                                                    -*-perl-*-
2
3$description = "Test the subst and patsubst functions";
4
5$details = "";
6
7# Generic patsubst test: test both the function and variable form.
8
9run_make_test('
10foo := a.o b.o c.o
11bar := $(foo:.o=.c)
12bar2:= $(foo:%.o=%.c)
13bar3:= $(patsubst %.c,%.o,x.c.c bar.c)
14all:;@echo $(bar); echo $(bar2); echo $(bar3)',
15'',
16'a.c b.c c.c
17a.c b.c c.c
18x.c.o bar.o');
19
20# Patsubst without '%'--shouldn't match because the whole word has to match
21# in patsubst.  Based on a bug report by Markus Mauhart <qwe123@chello.at>
22
23run_make_test('all:;@echo $(patsubst Foo,Repl,FooFoo)', '', 'FooFoo');
24
25# Variable subst where a pattern matches multiple times in a single word.
26# Based on a bug report by Markus Mauhart <qwe123@chello.at>
27
28run_make_test('
29A := fooBARfooBARfoo
30all:;@echo $(A:fooBARfoo=REPL)', '', 'fooBARREPL');
31
321;
33
34
35
36
37
38
39