[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Automake-NG] [FYI] [ng] coverage: more on make variable memoization
From: |
Stefano Lattarini |
Subject: |
[Automake-NG] [FYI] [ng] coverage: more on make variable memoization |
Date: |
Wed, 16 May 2012 10:04:29 +0200 |
* t/memoize.tap: Four new tests: three on memoized variables expanded
as arguments of a function call, one on memoized variables expanded
inside other memoized variables. While we are at it, improve brief
description of few existing tests.
Signed-off-by: Stefano Lattarini <address@hidden>
---
t/memoize.tap | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 61 insertions(+), 4 deletions(-)
diff --git a/t/memoize.tap b/t/memoize.tap
index ca7fede..b9188bf 100755
--- a/t/memoize.tap
+++ b/t/memoize.tap
@@ -19,7 +19,7 @@
am_create_testdir=empty
. ./defs || Exit 1
-plan_ 13
+plan_ 17
ocwd=`pwd` || fatal_ "couldn't get current working directory"
@@ -120,7 +120,7 @@ END
#---------------------------------------------------------------------------
-T "on indirect recursive variable expansion" <<'END'
+T "memoize indirect recursive variable expansion" <<'END'
foo = $(call am__memoize,foo,$(indir))
@@ -134,7 +134,7 @@ END
#---------------------------------------------------------------------------
-T "on indirect immediate variable expansion" <<'END'
+T "memoize indirect immediate variable expansion" <<'END'
foo = $(call am__memoize,foo,$(indir))
@@ -148,7 +148,7 @@ END
#---------------------------------------------------------------------------
-T "on function call" <<'END'
+T "memoize function call (containing builtin calls)" <<'END'
my_func = $(firstword $(sort $(1)))
foo = $(call am__memoize,foo,$(call my_func, 6 3 1 7))
@@ -160,6 +160,47 @@ END
#---------------------------------------------------------------------------
+T "expanded as function argument" <<'END'
+
+foo = $(call am__memoize,foo,bar)
+func = ::$(0)::$(1)::
+
+test:
+ test '$(call func,$(foo))' = ::func::bar::
+ test '$(foo)' = bar
+ # Once more.
+ test '$(call func,$(foo))' = ::func::bar::
+END
+
+#---------------------------------------------------------------------------
+
+T "expanded as function argument (trickier)" <<'END'
+
+foo = $(call am__memoize,foo,zardoz)
+indir_func = ::$($1)::
+
+test:
+ test '$(call indir_func,foo)' = ::zardoz::
+ test '$(foo)' = zardoz
+ # Once more.
+ test '$(call indir_func,foo)' = ::zardoz::
+END
+
+#---------------------------------------------------------------------------
+
+T "expanded into another memoized variable" <<'END'
+
+foo = $(call am__memoize,foo,one $(bar))
+bar = $(call am__memoize,bar,two $(baz))
+baz = $(call am__memoize,baz,$(sort 4 3))
+
+test:
+ test '$(foo)' = 'one two 3 4'
+ test '$(bar)' = 'two 3 4'
+END
+
+#---------------------------------------------------------------------------
+
T "memoization actually takes place (1)" <<'END'
indir := ok
@@ -176,6 +217,22 @@ END
T "memoization actually takes place (2)" <<'END'
+indir := ok
+expand = $(eval expanded-to := $$($1))
+foo = $(call am__memoize,foo,$(indir))
+$(call expand,foo)
+override indir := ko
+
+test:
+ test '$(foo)' = ok
+ test '$(indir)' = ko
+ test '$(expanded-to)' = ok
+END
+
+#---------------------------------------------------------------------------
+
+T "memoization actually takes place (3)" <<'END'
+
foo1 = $(call am__memoize,foo1,$(shell test -f x && echo "+"))
foo2 = $(call am__memoize,foo2,$(shell test -f y || echo "-"))
--
1.7.9.5
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Automake-NG] [FYI] [ng] coverage: more on make variable memoization,
Stefano Lattarini <=