summaryrefslogtreecommitdiff
path: root/tests/m4sh.at
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2010-07-02 15:35:45 -0600
committerEric Blake <eblake@redhat.com>2010-07-02 15:50:39 -0600
commitab90874a9a64ade3b99e3baeee9802330ff212d4 (patch)
treec6bd4201af434ae774f0f2aa31963e3477bc277c /tests/m4sh.at
parenta037f56c4090421040ba75ea51e9e61812b6ad45 (diff)
downloadautoconf-ab90874a9a64ade3b99e3baeee9802330ff212d4.tar.gz
Make AS_TR_SH and AS_TR_CPP similar.
* lib/m4sugar/m4sh.m4 (_AS_TR_CPP_LITERAL): Avoid underquoting. (_AS_TR_CPP_INDIR): Handle all polymorphic variables. * tests/m4sh.at (AS@&t@_TR_SH and AS@&t@_TR_CPP): New test. * NEWS: Document the fix. Reported by Bruno Haible. Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests/m4sh.at')
-rw-r--r--tests/m4sh.at77
1 files changed, 77 insertions, 0 deletions
diff --git a/tests/m4sh.at b/tests/m4sh.at
index f5ea7e20..96a2acb6 100644
--- a/tests/m4sh.at
+++ b/tests/m4sh.at
@@ -1169,6 +1169,83 @@ ok 16
AT_CLEANUP
+## --------------------- ##
+## AS_TR_SH, AS_TR_CPP. ##
+## --------------------- ##
+
+AT_SETUP([AS@&t@_TR_SH and AS@&t@_TR_CPP])
+
+AT_DATA_M4SH([script.as], [[dnl
+AS_INIT
+m4_define([abc], [hI])m4_define([ABC], [Hi])
+m4_define([hi], [oops])m4_define([HI], [OOPS])
+echo AS_TR_SH(abc) AS_TR_SH(aBc) AS_TR_SH(ABC)
+echo AS_TR_SH([abc]) AS_TR_SH([aBc]) AS_TR_SH([ABC])
+echo AS_TR_SH([[abc]]) AS_TR_SH([[aBc]]) AS_TR_SH([[ABC]])
+echo AS_TR_CPP(abc) AS_TR_CPP(aBc) AS_TR_CPP(ABC)
+echo AS_TR_CPP([abc]) AS_TR_CPP([aBc]) AS_TR_CPP([ABC])
+echo AS_TR_CPP([[abc]]) AS_TR_CPP([[aBc]]) AS_TR_CPP([[ABC]])
+echo ===
+[var=abc vAr=aBc VAR=ABC]
+echo AS_TR_SH($var) AS_TR_SH($vAr) AS_TR_SH($VAR)
+echo AS_TR_SH([$var]) AS_TR_SH([$vAr]) AS_TR_SH([$VAR])
+echo AS_TR_SH([[$var]]) AS_TR_SH([[$vAr]]) AS_TR_SH([[$VAR]])
+echo AS_TR_CPP($var) AS_TR_CPP($vAr) AS_TR_CPP($VAR)
+echo AS_TR_CPP([$var]) AS_TR_CPP([$vAr]) AS_TR_CPP([$VAR])
+echo AS_TR_CPP([[$var]]) AS_TR_CPP([[$vAr]]) AS_TR_CPP([[$VAR]])
+echo ===
+var=abc vAr=aBc VAR=ABC
+echo AS_TR_SH(`echo abc`) AS_TR_SH(`echo aBc`) AS_TR_SH(`echo ABC`)
+echo AS_TR_SH([`echo abc`]) AS_TR_SH([`echo aBc`]) AS_TR_SH([`echo ABC`])
+echo AS_TR_SH([[`echo abc`]]) AS_TR_SH([[`echo aBc`]]) AS_TR_SH([[`echo ABC`]])
+echo AS_TR_CPP(`echo abc`) AS_TR_CPP(`echo aBc`) AS_TR_CPP(`echo ABC`)
+echo AS_TR_CPP([`echo abc`]) AS_TR_CPP([`echo aBc`]) AS_TR_CPP([`echo ABC`])
+echo AS_TR_CPP([[`echo abc`]]) AS_TR_CPP([[`echo aBc`]]) AS_TR_CPP([[`echo ABC`]])
+echo ===
+echo AS_TR_SH([a.b/c+*-])
+echo AS_TR_CPP([a.b/c+*-])
+var=a.b/c+*-
+echo AS_TR_SH([$var])
+echo AS_TR_CPP([$var])
+m4_define([macro], [a.b/c+*-])
+echo AS_TR_SH([macro])
+echo AS_TR_CPP([macro])
+]])
+
+AT_CHECK_M4SH
+AT_CHECK([$CONFIG_SHELL ./script], [],
+[[hI aBc Hi
+hI aBc Hi
+abc aBc ABC
+HI ABC HI
+HI ABC HI
+ABC ABC ABC
+===
+abc aBc ABC
+abc aBc ABC
+abc aBc ABC
+ABC ABC ABC
+ABC ABC ABC
+ABC ABC ABC
+===
+hI aBc Hi
+hI aBc Hi
+abc aBc ABC
+HI ABC HI
+HI ABC HI
+ABC ABC ABC
+===
+a_b_cpp_
+A_B_C_P_
+a_b_cpp_
+A_B_C_P_
+a_b_cpp_
+A_B_C_P_
+]])
+
+AT_CLEANUP
+
+
## ---------- ##
## AS_VAR_*. ##
## ---------- ##