diff options
Diffstat (limited to 'contrib/bmake/unit-tests/modmisc.mk')
-rw-r--r-- | contrib/bmake/unit-tests/modmisc.mk | 61 |
1 files changed, 2 insertions, 59 deletions
diff --git a/contrib/bmake/unit-tests/modmisc.mk b/contrib/bmake/unit-tests/modmisc.mk index 8c20304ba1ef..043498fb1af4 100644 --- a/contrib/bmake/unit-tests/modmisc.mk +++ b/contrib/bmake/unit-tests/modmisc.mk @@ -1,4 +1,4 @@ -# $Id: modmisc.mk,v 1.1.1.2 2020/07/04 17:52:46 sjg Exp $ +# $Id: modmisc.mk,v 1.1.1.1 2014/08/30 18:57:18 sjg Exp $ # # miscellaneous modifier tests @@ -15,8 +15,7 @@ MOD_HOMES=S,/home/,/homes/, MOD_OPT=@d@$${exists($$d):?$$d:$${d:S,/usr,/opt,}}@ MOD_SEP=S,:, ,g -all: modvar modvarloop modsysv mod-HTE emptyvar undefvar -all: mod-S mod-C mod-at-varname mod-at-resolve +all: modvar modvarloop modsysv modsysv: @echo "The answer is ${libfoo.a:L:libfoo.a=42}" @@ -37,59 +36,3 @@ modvarloop: @echo "path_/usr/xbin=${path_/usr/xbin}" @echo "paths=${paths}" @echo "PATHS=${paths:tu}" - -PATHNAMES= a/b/c def a.b.c a.b/c a a.a .gitignore a a.a -mod-HTE: - @echo "dirname of '"${PATHNAMES:Q}"' is '"${PATHNAMES:H:Q}"'" - @echo "basename of '"${PATHNAMES:Q}"' is '"${PATHNAMES:T:Q}"'" - @echo "suffix of '"${PATHNAMES:Q}"' is '"${PATHNAMES:E:Q}"'" - @echo "root of '"${PATHNAMES:Q}"' is '"${PATHNAMES:R:Q}"'" - -# When a modifier is applied to the "" variable, the result is discarded. -emptyvar: - @echo S:${:S,^$,empty,} - @echo C:${:C,^$,empty,} - @echo @:${:@var@${var}@} - -# The :U modifier turns even the "" variable into something that has a value. -# The resulting variable is empty, but is still considered to contain a -# single empty word. This word can be accessed by the :S and :C modifiers, -# but not by the :@ modifier since it explicitly skips empty words. -undefvar: - @echo S:${:U:S,^$,empty,} - @echo C:${:U:C,^$,empty,} - @echo @:${:U:@var@empty@} - -mod-S: - @echo :${:Ua b b c:S,a b,,:Q}: - @echo :${:Ua b b c:S,a b,,1:Q}: - @echo :${:Ua b b c:S,a b,,W:Q}: - @echo :${:Ua b b c:S,b,,g:Q}: - @echo :${:U1 2 3 1 2 3:S,1 2,___,Wg:S,_,x,:Q}: - -mod-C: - @echo :${:Ua b b c:C,a b,,:Q}: - @echo :${:Ua b b c:C,a b,,1:Q}: - @echo :${:Ua b b c:C,a b,,W:Q}: - @echo :${:Uword1 word2:C,****,____,g:C,word,____,:Q}: - @echo :${:Ua b b c:C,b,,g:Q}: - @echo :${:U1 2 3 1 2 3:C,1 2,___,Wg:C,_,x,:Q}: - -# In the :@ modifier, the name of the loop variable can even be generated -# dynamically. There's no practical use-case for this, and hopefully nobody -# will ever depend on this, but technically it's possible. -mod-at-varname: - @echo :${:Uone two three:@${:Ubar:S,b,v,}@+${var}+@:Q}: - -# The :@ modifier resolves the variables a little more often than expected. -# In particular, it resolves _all_ variables from the context, and not only -# the loop variable (in this case v). -# -# The d means direct reference, the i means indirect reference. -RESOLVE= ${RES1} $${RES1} -RES1= 1d${RES2} 1i$${RES2} -RES2= 2d${RES3} 2i$${RES3} -RES3= 3 - -mod-at-resolve: - @echo $@:${RESOLVE:@v@w${v}w@:Q}: |