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

Re: PATCH v2: 48168: Fix handling of NUL bytes in zexpandtabs multibyte version



On 4/1/21, Jun T <takimoto-j@xxxxxxxxxxxxxxxxx> wrote:
> The test in B03 fails on macOS and FreeBSD (and maybe on other BSDs)
> because 'sed' can't handle the null byte.
>
> It seems 'tr' is more portable.
>
>
> diff --git a/Test/B03print.ztst b/Test/B03print.ztst
> index 563423934..4d2cf9764 100644
> --- a/Test/B03print.ztst
> +++ b/Test/B03print.ztst
> @@ -304,15 +304,16 @@
>   foo=$'one\ttwo\tthree\tfour\n'
>   foo+=$'\tone\ttwo\tthree\tfour\n'
>   foo+=$'\t\tone\t\ttwo\t\tthree\t\tfour'
> - print -x4 $foo
> - print -X4 $foo
> + foo+='\0' # regression test for multibyte tab expand
> + print -x4 $foo | tr '\0' Z # avoid raw nul byte in expected output below
> + print -X4 $foo | tr '\0' Z
>  0:Tab expansion by print
>  >one	two	three	four
>  >    one	two	three	four
> ->        one		two		three		four
> +>        one		two		three		fourZ
>  >one two three   four
>  >    one two three   four
> ->        one     two     three       four
> +>        one     two     three       fourZ
>
>   unset foo
>   print -v foo once more

Thanks for checking, I'll use this version instead.

-- 
Mikael Magnusson




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