Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Test ./E03posix.ztst was expected to fail, but passed.



> 2022/03/23 16:14, I wrote:
> 
> If the 'expected to fail' test exists for reminding us that we are
> (intentionally?) contradicting with POSIX, the test need be run under
> UTF-8 locale (in D07multibyte.ztst), with
> 
>> < Stéphane>      # single ' ' before 'S'


In the following patch the test is moved to D07multibyte.ztst, and
another test (expected to fail) is added to indicate that the precision
(5 in '%7.5s') should also be computed in bytes.


diff --git a/Test/D07multibyte.ztst b/Test/D07multibyte.ztst
index 7f046525a..cbd802f23 100644
--- a/Test/D07multibyte.ztst
+++ b/Test/D07multibyte.ztst
@@ -347,6 +347,18 @@
 0:Multibyte characters in printf widths
 > főo
 
+# TODO?: POSIX requires that printf should always compute width and
+# precision of '%s' conversion in bytes, while zsh computes them in
+# characters if multi-byte locale is in use.
+  ARGV0=sh $ZTST_testdir/../Src/zsh -c "printf '<%10s>\n' St$'\M-C\M-)'phane"
+0f:POSIX: width in %s should be computed in bytes, not in characters
+F:This is considered a bugfix in zsh
+>< Stéphane>
+
+  ARGV0=sh $ZTST_testdir/../Src/zsh -c "printf '<%7.5s>\n' St$'\M-C\M-)'phane"
+0f:POSIX: precision should also be computed in bytes, not in characers
+><  Stép>
+
 # We ask for case-insensitive sorting here (and supply upper case
 # characters) so that we exercise the logic in the shell that lowers the
 # case of the string for case-insensitive sorting.
diff --git a/Test/E03posix.ztst b/Test/E03posix.ztst
index b191199ad..caab97ab6 100644
--- a/Test/E03posix.ztst
+++ b/Test/E03posix.ztst
@@ -157,10 +157,5 @@ F:POSIX has neither math functions nor floating point
 -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>
-
   PPID=foo
 -f:PPID is not a readonly variable



Messages sorted by: Reverse Date, Date, Thread, Author