Changeset 284 in kBuild for branches/GNU/src/gmake/tests/scripts/functions/substitution
- Timestamp:
- May 16, 2005 4:54:08 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/gmake/tests/scripts/functions/substitution
r53 r284 1 $description = "The following test creates a makefile to ..."; 1 # -*-perl-*- 2 3 $description = "Test the subst and patsubst functions"; 2 4 3 5 $details = ""; 4 6 5 open(MAKEFILE,"> $makefile"); 7 # Generic patsubst test: test both the function and variable form. 6 8 7 # The Contents of the MAKEFILE ... 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'); 8 19 9 print MAKEFILE "foo := a.o b.o c.o\n" 10 ."bar := \$(foo:.o=.c)\n" 11 ."bar2:= \$(foo:%.o=%.c)\n" 12 ."bar3:= \$(patsubst %.c,%.o,x.c.c bar.c)\n" 13 ."all:\n" 14 ."\t\@echo \$(bar)\n" 15 ."\t\@echo \$(bar2)\n" 16 ."\t\@echo \$(bar3)\n"; 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> 17 22 18 # END of Contents of MAKEFILE 23 run_make_test('all:;@echo $(patsubst Foo,Repl,FooFoo)', '', 'FooFoo'); 19 24 20 close(MAKEFILE); 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> 21 27 22 &run_make_with_options($makefile,"",&get_logfile); 23 24 # Create the answer to what should be produced by this Makefile 25 $answer = "a.c b.c c.c\n" 26 ."a.c b.c c.c\n" 27 ."x.c.o bar.o\n"; 28 29 &compare_output($answer,&get_logfile(1)); 28 run_make_test(' 29 A := fooBARfooBARfoo 30 all:;@echo $(A:fooBARfoo=REPL)', '', 'fooBARREPL'); 30 31 31 32 1;
Note:
See TracChangeset
for help on using the changeset viewer.

