From 29cd838eab01ed7110f3ccb2e8c6a35c8a31dbcc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 11 Apr 2024 10:21:29 +0200 Subject: Adding upstream version 1:0.1.9998svn3589+dfsg. Signed-off-by: Daniel Baumann --- src/kmk/tests/scripts/functions/filter-out | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/kmk/tests/scripts/functions/filter-out (limited to 'src/kmk/tests/scripts/functions/filter-out') diff --git a/src/kmk/tests/scripts/functions/filter-out b/src/kmk/tests/scripts/functions/filter-out new file mode 100644 index 0000000..1fe4819 --- /dev/null +++ b/src/kmk/tests/scripts/functions/filter-out @@ -0,0 +1,42 @@ +# -*-perl-*- + +$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 +.o with a single simple pattern. The second filter-out function +augments the simple pattern with three literal names, which are +also added to the text argument. This tests an internal hash table +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"; + +# 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"); + +# 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)' +!, + '', "foo.elc foo.elc\n"); + +# Escaped patterns +run_make_test(q!all:;@echo '$(filter foo\%bar,foo%bar fooXbar)'!, + '', "foo%bar\n"); + +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