mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-02 22:11:54 +02:00
Change TYPESET_DOES_NOT_SET to TYPESET_TO_UNSET to avoid double-negative
This commit is contained in:
parent
e67ccd7f1e
commit
b3613e4895
7 changed files with 67 additions and 5 deletions
|
@ -1872,7 +1872,11 @@ ifnzman(noderef(Local Parameters))\
|
|||
retain their special attributes when made local.
|
||||
|
||||
For each var(name)tt(=)var(value) assignment, the parameter
|
||||
var(name) is set to var(value).
|
||||
var(name) is set to var(value). If the assignment is omitted and var(name)
|
||||
does em(not) refer to an existing parameter, a new parameter is intialized
|
||||
to empty string, zero, or empty array (as appropriate), em(unless) the
|
||||
shell option tt(TYPESET_TO_UNSET) is set. When that option is set,
|
||||
the parameter attributes are recorded but the parameter remains unset.
|
||||
|
||||
If the shell option tt(TYPESET_SILENT) is not set, for each remaining
|
||||
var(name) that refers to a parameter that is already set, the name and
|
||||
|
|
|
@ -1926,6 +1926,16 @@ If the option is set, they will only be shown when parameters are selected
|
|||
with the `tt(-m)' option. The option `tt(-p)' is available whether or not
|
||||
the option is set.
|
||||
)
|
||||
pindex(TYPESET_TO_UNSET)
|
||||
pindex(NO_TYPESET_TO_UNSET)
|
||||
pindex(TYPESETTOUNSET)
|
||||
pindex(NOTYPESETTOUNSET)
|
||||
item(tt(TYPESET_TO_UNSET) <K> <S>)(
|
||||
When declaring a new parameter with any of the `tt(typeset)' family of
|
||||
related commands, the parameter remains unset unless and until a
|
||||
value is explicity assigned to it, either in the `tt(typeset)' command
|
||||
itself or as a later assignment statement.
|
||||
)
|
||||
pindex(VERBOSE)
|
||||
pindex(NO_VERBOSE)
|
||||
pindex(NOVERBOSE)
|
||||
|
|
|
@ -2491,7 +2491,7 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
if (isset(TYPESETDOESNOTSET))
|
||||
if (isset(TYPESETTOUNSET))
|
||||
pm->node.flags |= PM_DEFAULTED;
|
||||
} else {
|
||||
if (idigit(*pname))
|
||||
|
|
|
@ -257,8 +257,8 @@ static struct optname optns[] = {
|
|||
{{NULL, "sunkeyboardhack", 0}, SUNKEYBOARDHACK},
|
||||
{{NULL, "transientrprompt", 0}, TRANSIENTRPROMPT},
|
||||
{{NULL, "trapsasync", 0}, TRAPSASYNC},
|
||||
{{NULL, "typesetdoesnotset", OPT_EMULATE|OPT_BOURNE}, TYPESETDOESNOTSET},
|
||||
{{NULL, "typesetsilent", OPT_EMULATE|OPT_BOURNE}, TYPESETSILENT},
|
||||
{{NULL, "typesettounset", OPT_EMULATE|OPT_BOURNE}, TYPESETTOUNSET},
|
||||
{{NULL, "unset", OPT_EMULATE|OPT_BSHELL}, UNSET},
|
||||
{{NULL, "verbose", 0}, VERBOSE},
|
||||
{{NULL, "vi", 0}, VIMODE},
|
||||
|
|
|
@ -2536,8 +2536,8 @@ enum {
|
|||
SUNKEYBOARDHACK,
|
||||
TRANSIENTRPROMPT,
|
||||
TRAPSASYNC,
|
||||
TYPESETDOESNOTSET,
|
||||
TYPESETSILENT,
|
||||
TYPESETTOUNSET,
|
||||
UNSET,
|
||||
VERBOSE,
|
||||
VIMODE,
|
||||
|
|
|
@ -289,3 +289,8 @@ F:Regression test for workers/42297
|
|||
>14 24
|
||||
>b b
|
||||
>b?rbaz foob?r
|
||||
|
||||
i=1,3
|
||||
[[ ${a[$i]} = ${a[i]} ]]
|
||||
0f:Math evaluation of commas in array subscripts
|
||||
F:In math, (($i)) should be the same as ((i)).
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
|
||||
%prep
|
||||
setopt POSIX_BUILTINS TYPESET_DOES_NOT_SET
|
||||
setopt POSIX_BUILTINS TYPESET_TO_UNSET
|
||||
|
||||
%test
|
||||
|
||||
|
@ -117,3 +117,46 @@
|
|||
}
|
||||
0:readonly with typeset -p
|
||||
>typeset -g -r var
|
||||
|
||||
# Tests expected to fail
|
||||
|
||||
echo -
|
||||
0f:A single "-" for echo does not end the arguments
|
||||
F:POSIX requires a solitary "-" to be a plain argument
|
||||
>-
|
||||
|
||||
ARGV0=sh $ZTST_testdir/../Src/zsh -c 'foreach() { true; }'
|
||||
-f:"foreach" is not a reserved word
|
||||
|
||||
ARGV0=sh $ZTST_testdir/../Src/zsh -c 'end() { true; }
|
||||
-f:"end" is not a reserved word
|
||||
|
||||
a='a:b:' ARGV0=sh $ZTST_testdir/../Src/zsh -c 'IFS=:; printf "<%s>\n" $a'
|
||||
0f:IFS is a separator, not a delimiter
|
||||
><a>
|
||||
><b>
|
||||
|
||||
a=$'\ra\r\rb' ARGV0=sh $ZTST_testdir/../Src/zsh -c 'IFS=:; printf "<%s>\n" $a'
|
||||
0f:All whitespace characters are "IFS whitespace"
|
||||
F:isspace('\r') is true so \r should behave like space, \t, \n
|
||||
F:This may also need to apply to multibyte whitespace
|
||||
><a>
|
||||
><b>
|
||||
|
||||
ARGV0=sh $ZTST_testdir/../Src/zsh -c 'IFS=2; printf "<%s>\n" $((11*11))'
|
||||
0f:IFS applies to math results (numbers treated as strings)
|
||||
><1>
|
||||
><1>
|
||||
|
||||
ARGV0=sh $ZTST_testdir/../Src/zsh -c 'inf=42; echo $((inf))'
|
||||
0f:The math constant Inf is case-sensitive, with capital I
|
||||
>42
|
||||
|
||||
ARGV0=sh $ZTST_testdir/../Src/zsh -c 'EUID=10; echo "$EUID"'
|
||||
-f:EUID is not a special variable
|
||||
>10
|
||||
|
||||
ARGV0=sh $ZTST_testdir/../Src/zsh -c "printf '<%10s>\n' St$'\M-C\M-)'phane"
|
||||
0f:Width of %s is computed in bytes not characters
|
||||
F:This is considered a bugfix in zsh
|
||||
>< Stéphane>
|
||||
|
|
Loading…
Reference in a new issue