diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ChangeLog | 5 | ||||
-rw-r--r-- | tests/scripts/functions/call | 16 |
2 files changed, 19 insertions, 2 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index 3ff614d..b38d5db 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,8 @@ +2002-04-28 Paul D. Smith <psmith@gnu.org> + + * scripts/functions/call: New test: transitive closure + implementation using $(call ...) to test variable recursion. + 2002-04-21 Paul D. Smith <psmith@gnu.org> * test_driver.pl (compare_dir_tree): Ignore CVS and RCS diff --git a/tests/scripts/functions/call b/tests/scripts/functions/call index bdb8e89..a8834cd 100644 --- a/tests/scripts/functions/call +++ b/tests/scripts/functions/call @@ -31,6 +31,15 @@ my-if = $(if $(1),$(2),$(3)) one = $(1) $(2) $(3) two = $(call one,$(1),foo,$(2)) +# Test recursion on the user-defined function. As a special case make +# won't error due to this. +# Implement transitive closure using $(call ...) +# +DEP_foo = bar baz quux +DEP_baz = quux blarp +rest = $(wordlist 2,$(words ${1}),${1}) +tclose = $(if $1,$(firstword $1) \ + $(call tclose,$(sort ${DEP_$(firstword $1)} $(call rest,$1)))) all: ; @echo '$(call reverse,bar,foo)'; \ echo '$(call map,origin,MAKE reverse map)'; \ @@ -38,7 +47,10 @@ all: ; @echo '$(call reverse,bar,foo)'; \ echo '$(call my-foreach)'; \ echo '$(call my-foreach,a,,,)'; \ echo '$(call my-if,a,b,c)'; \ - echo '$(call two,bar,baz)' + echo '$(call two,bar,baz)'; \ + echo '$(call tclose,foo)' + + EOMAKE @@ -53,7 +65,7 @@ EOMAKE close(MAKEFILE); &run_make_with_options($makefile, "", &get_logfile); -$answer = "foo bar\ndefault file file\nb d f\n\n\nb\nbar foo baz\n"; +$answer = "foo bar\ndefault file file\nb d f\n\n\nb\nbar foo baz\nfoo bar baz blarp quux \n"; &compare_output($answer, &get_logfile(1)); |