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 9 run_make_test(' 10 foo := a.o b.o c.o 11 bar := $(foo:.o=.c) 12 bar2:= $(foo:%.o=%.c) 13 bar3:= $(patsubst %.c,%.o,x.c.c bar.c) 14 all:;@echo $(bar); echo $(bar2); echo $(bar3)', 15 '', 16 'a.c b.c c.c 17 a.c b.c c.c 18 x.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 (a] chello.at> 22 23 run_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 (a] chello.at> 27 28 run_make_test(' 29 A := fooBARfooBARfoo 30 all:;@echo $(A:fooBARfoo=REPL)', '', 'fooBARREPL'); 31 32 1; 33 34 35 36 37 38 39