Revert "test harness: Rewrite the columnar pretty-printer without external tools." and "travis: Remove bsdmainutils since column(1) has been removed, three commits ago."

This reverts commits ea7c165b59 and
3d81c83132.

When "have 6 expectations and 4 region_highlight entries", the pure-zsh
implementation printed them as follows:

    not ok 7 - cardinality check - have 6 expectations and 4 region_highlight entries: «expected_region_highlight=( $'1 1 builtin' $'3 6 comment' $'8 13 comment' $'15 15 default' $'16 21 comment' $'22 22 default' )»
    «region_highlight=( $'0 1 builtin' $'2 6 comment' $'7 13 comment' $'14 22 default' )»
    # expected_region_highlight  '22 22 default'
    # '1 1 builtin'              region_highlight
    # '3 6 comment'              '0 1 builtin'
    # '8 13 comment'             '2 6 comment'
    # '15 15 default'            '7 13 comment'
    # '16 21 comment'            '14 22 default'

Whereas the column(1)-based implementation prints them as follows:

    not ok 7 - cardinality check - have 6 expectations and 4 region_highlight entries: «expected_region_highlight=( $'1 1 builtin' $'3 6 comment' $'8 13 comment' $'15 15 default' $'16 21 comment' $'22 22 default' )» «region_highlight=( $'0 1 builtin' $'2 6 comment' $'7 13 comment' $'14 22 default' )»
    # expected_region_highlight  region_highlight
    # '1 1 builtin'              '0 1 builtin'
    # '3 6 comment'              '2 6 comment'
    # '8 13 comment'             '7 13 comment'
    # '15 15 default'            '14 22 default'
    # '16 21 comment'
    # '22 22 default'

Ultimately, this difference is down to the pure-zsh implementation
getting the arguments as a single list, whereas paste(1) gets two
separate lists.
This commit is contained in:
Daniel Shahaf 2020-03-19 22:39:30 +00:00
parent 8eaa41431d
commit d5d2f22013
2 changed files with 5 additions and 2 deletions

View file

@ -35,7 +35,7 @@ env:
- ZSH=4.3.12
- ZSH=4.3.11
script: docker run -v $PWD:/work -w /work zshusers/zsh:${ZSH} /bin/sh -c 'install_packages make procps && make test'
script: docker run -v $PWD:/work -w /work zshusers/zsh:${ZSH} /bin/sh -c 'install_packages make procps bsdmainutils && make test'
notifications:
webhooks:

View file

@ -230,7 +230,10 @@ run_test_internal() {
if (( difference > 0 )); then
left_column+=( ${(r:2*difference::. :):-} )
fi
print -rC2 -- "${left_column[@]}" "${right_column[@]}" \
paste \
=(print -rC1 -- $left_column) \
=(print -rC1 -- $right_column) \
| if type column >/dev/null; then column -t -s $'\t'; else cat; fi \
| sed 's/^/# /'
}
fi