From d5d2f22013e673b3395373aa8a5df59ed0d94972 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 19 Mar 2020 22:39:30 +0000 Subject: [PATCH] Revert "test harness: Rewrite the columnar pretty-printer without external tools." and "travis: Remove bsdmainutils since column(1) has been removed, three commits ago." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commits ea7c165b592f4a8b93a372113c600b3cfa36601e and 3d81c83132e8798e72590ee8d7e956558113e9c3. 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. --- .travis.yml | 2 +- tests/test-highlighting.zsh | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 39040f8..39dd445 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: diff --git a/tests/test-highlighting.zsh b/tests/test-highlighting.zsh index e03287f..d12b44c 100755 --- a/tests/test-highlighting.zsh +++ b/tests/test-highlighting.zsh @@ -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