diff options
| author | Mikael Magnusson <mikachu@gmail.com> | 2026-06-07 01:48:20 +0200 |
|---|---|---|
| committer | Mikael Magnusson <mikachu@gmail.com> | 2026-06-14 01:56:15 +0200 |
| commit | e5f58a80ba5124735d6434845ea382a5db1f1875 (patch) | |
| tree | 0554fe54d4dcd9003b7d96fb5bd083e000c52d5a /Test | |
| parent | 54677: tests: improve readability (diff) | |
| download | zsh-e5f58a80ba5124735d6434845ea382a5db1f1875.tar zsh-e5f58a80ba5124735d6434845ea382a5db1f1875.tar.gz zsh-e5f58a80ba5124735d6434845ea382a5db1f1875.tar.bz2 zsh-e5f58a80ba5124735d6434845ea382a5db1f1875.tar.lz zsh-e5f58a80ba5124735d6434845ea382a5db1f1875.tar.xz zsh-e5f58a80ba5124735d6434845ea382a5db1f1875.tar.zst zsh-e5f58a80ba5124735d6434845ea382a5db1f1875.zip | |
54710: handle multibyte arguments in error messages
A lot of places check option strings char by char, then send that char
to zwarn/zerr, instead of reading out the full multibyte character.
Doing so is quite easy with unmeta_one in most cases, so just go ahead
and do that. The print functions in fact expect a wchar_t for %c anyway.
Also renames "unknown option" to "bad option" because that's what every
other place calls it (also one place was missing the colon, added that).
To reproduce the math errors, since it's slightly less obvious (you need
a multibyte character that is also an invalid parameter name, otherwise
it actually works fine)
% zsh -c '(( ¯ ))'
zsh:1: bad math expression: illegal character: ^
% zsh -c 'zmodload zsh/mathfunc; (( sin(1¯) ))'
zsh:1: bad math expression: illegal character: ^
% zsh -c 'の=5; echo $(( の ))' # unchanged because it is working
5
Also adds some tests because B12 was looking very empty, not sure if
this is the correct way to handle the intersection of possibly not
compiled module with possibly not available UTF-8 locale, but X02 and
some others do a similar thing with ZSH_TEST_LANG, though in those cases
that's handled specially by comptest, not the test itself.
Diffstat (limited to 'Test')
| -rw-r--r-- | Test/B12limit.ztst | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Test/B12limit.ztst b/Test/B12limit.ztst index 9dce59824..bc73d660a 100644 --- a/Test/B12limit.ztst +++ b/Test/B12limit.ztst @@ -1,6 +1,7 @@ %prep + ZSH_TEST_LANG=$(ZTST_find_UTF8) if ! zmodload zsh/rlimits 2>/dev/null then ZTST_unimplemented="the zsh/rlimits module was disabled by configure (see config.modules)" @@ -26,3 +27,27 @@ F:report this to zsh-workers mailing list. } 0:check if limit option letters are unique + ulimit -z +1:bad option letter +?(eval):ulimit:1: bad option: -z + + ulimit -N +1:missing number after -N +?(eval):ulimit:1: number required after -N + + ulimit -N abc +1:invalid number after -N +?(eval):ulimit:1: invalid number: abc + + ulimit -at +1:resource option combined with -a +?(eval):ulimit:1: no limits allowed with -a + + if [[ -z $ZSH_TEST_LANG ]]; then + ZTST_skip='no UTF-8 locale' + else + LANG=$ZSH_TEST_LANG + ulimit -の + fi +1:bad multibyte option letter +?(eval):ulimit:5: bad option: -の |
