From 69b4b8bdde76b5aee6befa2b66957db22b3f6353 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 7 Dec 2004 16:54:58 +0000 Subject: 20605: Use separate structure with get/set/unset methods fro parameters. Separate justification width of parameters from base/precision. --- Test/B02typeset.ztst | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 93 insertions(+), 1 deletion(-) (limited to 'Test') diff --git a/Test/B02typeset.ztst b/Test/B02typeset.ztst index 752a8e94a..0d7f0dcd5 100644 --- a/Test/B02typeset.ztst +++ b/Test/B02typeset.ztst @@ -18,7 +18,6 @@ # Function tracing (typeset -ft) E02xtrace # Not yet tested: -# Justification (-L, -R, -Z) # Case conversion (-l, -u) # Assorted illegal flag combinations @@ -244,6 +243,99 @@ 0:Local scalar subscript assignment >abc + typeset -L 10 fools + for fools in " once" "twice" " thrice" " oops too long here"; do + print "'$fools'" + done +0:Left justification of scalars +>'once ' +>'twice ' +>'thrice ' +>'oops too l' + + typeset -L 10 -F 3 foolf + for foolf in 1.3 4.6 -2.987 -4.91031; do + print "'$foolf'" + done +0:Left justification of floating point +>'1.300 ' +>'4.600 ' +>'-2.987 ' +>'-4.910 ' + + typeset -L 10 -Z foolzs + for foolzs in 001.3 04.6 -2.987 -04.91231; do + print "'$foolzs'" + done +0:Left justification of scalars with zero suppression +>'1.3 ' +>'4.6 ' +>'-2.987 ' +>'-04.91231 ' + + typeset -R 10 foors + for foors in short longer even-longer; do + print "'$foors'" + done +0:Right justification of scalars +>' short' +>' longer' +>'ven-longer' + + typeset -Z 10 foozs + for foozs in 42 -42 " 43" " -43"; do + print "'$foozs'" + done +0:Right justification of scalars with zeroes +>'0000000042' +>' -42' +>' 000000043' +>' -43' + + integer -Z 10 foozi + for foozi in 42 -42 " 43" " -43"; do + print "'$foozi'" + done +0:Right justification of integers with zero, no initial base +>'0000000042' +>'-000000042' +>'0000000043' +>'-000000043' +# In case you hadn't twigged, the spaces are absorbed in the initial +# math evaluation, so don't get through. + + unsetopt cbases + integer -Z 10 -i 16 foozi16 + for foozi16 in 42 -42 " 43" " -43"; do + print "'$foozi16'" + done +0:Right justification of integers with zero, base 16, C_BASES off +>'16#000002A' +>'-16#00002A' +>'16#000002B' +>'-16#00002B' + + setopt cbases + integer -Z 10 -i 16 foozi16c + for foozi16c in 42 -42 " 43" " -43"; do + print "'$foozi16c'" + done +0:Right justification of integers with zero, base 16, C_BASES on +>'0x0000002A' +>'-0x000002A' +>'0x0000002B' +>'-0x000002B' + + typeset -F 3 -Z 10 foozf + for foozf in 3.14159 -3.14159 4 -4; do + print "'$foozf'" + done +0:Right justification of fixed point numbers with zero +>'000003.142' +>'-00003.142' +>'000004.000' +>'-00004.000' + stress00 print $scalar $array 0q:Stress test: all parameters are local and unset, using -m -- cgit 1.4.1