summaryrefslogtreecommitdiff
path: root/t/internals.tap
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2012-05-24 21:14:46 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2012-05-25 01:54:00 +0200
commitfa806737f8739a248a7ab032e9682d5b738dae90 (patch)
treedfb1febc4bde7f0848ebddb8afc77de93c6d2e5f /t/internals.tap
parent4486c689bd6ef4c5c9aa6e7cabe528df499f33b7 (diff)
downloadautomake-fa806737f8739a248a7ab032e9682d5b738dae90.tar.gz
am: make function to canonicalize names
We implement a make function that canonicalizes names the same way the automake script does (with the '&canonicalize' perl function): sub/prog => sub_prog libx-old.a => libx_old_a devel/libx.a => devel_libx_a This new make function is still unused in our codebase, but it's nice to have it ther,e ready and tested, should the need for it ever arise. * lib/am/header-vars.am (am__canon): New function. (am__bslash, am__comma, am__dollar, am__pound, am__lparen, am__rparen, am__bquote, am__dquote, am__squote ): New immediate variables, used by the above function to avoid spurious syntax errors (e.g., $(am__comma) expands to ',', which would be unusable directly in a make function call). * t/internals.tap: Extend. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Diffstat (limited to 't/internals.tap')
-rwxr-xr-xt/internals.tap35
1 files changed, 28 insertions, 7 deletions
diff --git a/t/internals.tap b/t/internals.tap
index 44b8912ce..669e09e96 100755
--- a/t/internals.tap
+++ b/t/internals.tap
@@ -19,7 +19,7 @@
am_create_testdir=empty
. ./defs || Exit 1
-plan_ 6
+plan_ 7
cp "$am_amdir"/header-vars.am . \
|| fatal_ "fetching makefile fragment headers-vars.am"
@@ -34,8 +34,12 @@ rm -f header-vars.am
cat > Makefile << 'END'
include ./defn.mk
-lo = abcdefghijklmnopqrstuvwxyz
-up = ABCDEFGHIJKLMNOPQRSTUVWXYZ
+lower = abcdefghijklmnopqrstuvwxyz
+upper = ABCDEFGHIJKLMNOPQRSTUVWXYZ
+digits = 0123456789
+comma = ,
+dollar = $$
+bslash = \\
default:
@echo Please select an explicit test; exit 1
@@ -125,8 +129,8 @@ test-toupper:
test '$(call am__toupper,@:&/?-)' = '@:&/?-'
test '$(call am__toupper,a@B)' = A@B
test '$(call am__toupper,zxzxzxZXZxzxzxzxzx)' = ZXZXZXZXZXZXZXZXZX
- test '$(call am__toupper,$(lo))' = '$(up)'
- test '$(call am__toupper,$(up))' = '$(up)'
+ test '$(call am__toupper,$(lower))' = '$(upper)'
+ test '$(call am__toupper,$(upper))' = '$(upper)'
.PHONY: test-tolower
test-tolower:
@@ -142,8 +146,24 @@ test-tolower:
test '$(call am__tolower,@:&/?-)' = '@:&/?-'
test '$(call am__tolower,a@B)' = a@b
test '$(call am__tolower,ZXZXZXzxzXZXZXZXZX)' = zxzxzxzxzxzxzxzxzx
- test '$(call am__tolower,$(up))' = '$(lo)'
- test '$(call am__tolower,$(lo))' = '$(lo)'
+ test '$(call am__tolower,$(upper))' = '$(lower)'
+ test '$(call am__tolower,$(lower))' = '$(lower)'
+
+.PHONY: test-canonicalize
+test-canonicalize:
+ test '$(call am__canon,A)' = A
+ test '$(call am__canon, b)' = b
+ test '$(call am__canon, foo )' = foo
+ test '$(call am__canon,$(upper)$(lower)$(digits)_)' = '$(upper)$(lower)$(digits)_'
+ test '$(call am__canon,@)' = '@'
+ test '$(call am__canon,%)' = '_'
+ test '$(call am__canon,.&@!;)' = '__@__'
+ test '$(call am__canon,')' = '_'
+ test '$(call am__canon,$(dollar))' = '_'
+ test '$(call am__canon,$(bslash))' = '_'
+ test '$(call am__canon,$(comma))' = '_'
+ test '$(call am__canon,$(bslash)$(comma))' = '__'
+ test '$(call am__canon,x$(comma)@$(bslash))' = 'x_@_'
END
command_ok_ am__strip_firstword $MAKE test-strip-firstword
@@ -152,5 +172,6 @@ command_ok_ am__uniq $MAKE test-uniq
command_ok_ am__test_strip_suffixes $MAKE test-strip-suffixes
command_ok_ am__tolower $MAKE test-tolower
command_ok_ am__toupper $MAKE test-toupper
+command_ok_ am__canon $MAKE test-canonicalize
: