From a77c5c09100ef56940546b543dd1c515529ca4bb Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Sat, 3 Mar 2012 22:12:46 +0000 Subject: Fix Savannah bug #35410: handle escape chars in filter/filter-out Also add a valgrind suppression file for Guile-enabled make. --- tests/scripts/functions/filter-out | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'tests/scripts/functions/filter-out') diff --git a/tests/scripts/functions/filter-out b/tests/scripts/functions/filter-out index 6c8b27a..1fe4819 100644 --- a/tests/scripts/functions/filter-out +++ b/tests/scripts/functions/filter-out @@ -1,6 +1,6 @@ # -*-perl-*- -$description = "Test the filter-out function."; +$description = "Test the filter and filter-out functions."; $details = "The makefile created in this test has two variables. The filter-out function is first used to discard names ending in @@ -11,18 +11,32 @@ which is only used if there are multiple literals present in both the pattern and text arguments. The result of both filter-out functions is the same single .elc name.\n"; -open(MAKEFILE,"> $makefile"); +# Basic test -- filter +run_make_test(q! +files1 := $(filter %.o, foo.elc bar.o lose.o) +files2 := $(filter %.o foo.i, foo.i bar.i lose.i foo.elc bar.o lose.o) +all: ; @echo '$(files1) $(files2)' +!, + '', "bar.o lose.o foo.i bar.o lose.o\n"); -print MAKEFILE <<'EOF'; +# Basic test -- filter-out +run_make_test(q! files1 := $(filter-out %.o, foo.elc bar.o lose.o) files2 := $(filter-out foo.i bar.i lose.i %.o, foo.i bar.i lose.i foo.elc bar.o lose.o) -all: ; @echo $(files1) $(files2) -EOF +all: ; @echo '$(files1) $(files2)' +!, + '', "foo.elc foo.elc\n"); -close(MAKEFILE); +# Escaped patterns +run_make_test(q!all:;@echo '$(filter foo\%bar,foo%bar fooXbar)'!, + '', "foo%bar\n"); -&run_make_with_options($makefile, "", &get_logfile, 0); -$answer = "foo.elc foo.elc\n"; -&compare_output($answer,&get_logfile(1)); +run_make_test(q!all:;@echo '$(filter foo\%\%\\\\\%\%bar,foo%%\\%%bar fooX\\Ybar)'!, + '', "foo%%\\%%bar\n"); + +run_make_test(q! +X = $(filter foo\\\\\%bar,foo\%bar foo\Xbar) +all:;@echo '$(X)'!, + '', "foo\\%bar\n"); 1; -- cgit v1.2.3