| 1 | # -*-perl-*-
|
|---|
| 2 |
|
|---|
| 3 | $description = "Test the filter and filter-out functions.";
|
|---|
| 4 |
|
|---|
| 5 | $details = "The makefile created in this test has two variables. The
|
|---|
| 6 | filter-out function is first used to discard names ending in
|
|---|
| 7 | .o with a single simple pattern. The second filter-out function
|
|---|
| 8 | augments the simple pattern with three literal names, which are
|
|---|
| 9 | also added to the text argument. This tests an internal hash table
|
|---|
| 10 | which is only used if there are multiple literals present in both
|
|---|
| 11 | the pattern and text arguments. The result of both filter-out
|
|---|
| 12 | functions is the same single .elc name.\n";
|
|---|
| 13 |
|
|---|
| 14 | # Basic test -- filter
|
|---|
| 15 | run_make_test(q!
|
|---|
| 16 | files1 := $(filter %.o, foo.elc bar.o lose.o)
|
|---|
| 17 | files2 := $(filter %.o foo.i, foo.i bar.i lose.i foo.elc bar.o lose.o)
|
|---|
| 18 | all: ; @echo '$(files1) $(files2)'
|
|---|
| 19 | !,
|
|---|
| 20 | '', "bar.o lose.o foo.i bar.o lose.o\n");
|
|---|
| 21 |
|
|---|
| 22 | # Basic test -- filter-out
|
|---|
| 23 | run_make_test(q!
|
|---|
| 24 | files1 := $(filter-out %.o, foo.elc bar.o lose.o)
|
|---|
| 25 | files2 := $(filter-out foo.i bar.i lose.i %.o, foo.i bar.i lose.i foo.elc bar.o lose.o)
|
|---|
| 26 | all: ; @echo '$(files1) $(files2)'
|
|---|
| 27 | !,
|
|---|
| 28 | '', "foo.elc foo.elc\n");
|
|---|
| 29 |
|
|---|
| 30 | # Escaped patterns
|
|---|
| 31 | run_make_test(q!all:;@echo '$(filter foo\%bar,foo%bar fooXbar)'!,
|
|---|
| 32 | '', "foo%bar\n");
|
|---|
| 33 |
|
|---|
| 34 | run_make_test(q!all:;@echo '$(filter foo\%\%\\\\\%\%bar,foo%%\\%%bar fooX\\Ybar)'!,
|
|---|
| 35 | '', "foo%%\\%%bar\n");
|
|---|
| 36 |
|
|---|
| 37 | run_make_test(q!
|
|---|
| 38 | X = $(filter foo\\\\\%bar,foo\%bar foo\Xbar)
|
|---|
| 39 | all:;@echo '$(X)'!,
|
|---|
| 40 | '', "foo\\%bar\n");
|
|---|
| 41 |
|
|---|
| 42 | 1;
|
|---|