diff options
| author | Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> | 2026-07-01 02:37:55 +0900 |
|---|---|---|
| committer | Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> | 2026-07-01 02:37:55 +0900 |
| commit | e5ebaed2cf9c768ed9c3f770765bd1c5bcc8a2c7 (patch) | |
| tree | e3648c628c9c5f9187f5b4b8fc998124c98aed76 | |
| parent | unposted: _nano: fix syntaxes tag (diff) | |
| download | zsh-e5ebaed2cf9c768ed9c3f770765bd1c5bcc8a2c7.tar zsh-e5ebaed2cf9c768ed9c3f770765bd1c5bcc8a2c7.tar.gz zsh-e5ebaed2cf9c768ed9c3f770765bd1c5bcc8a2c7.tar.bz2 zsh-e5ebaed2cf9c768ed9c3f770765bd1c5bcc8a2c7.tar.lz zsh-e5ebaed2cf9c768ed9c3f770765bd1c5bcc8a2c7.tar.xz zsh-e5ebaed2cf9c768ed9c3f770765bd1c5bcc8a2c7.tar.zst zsh-e5ebaed2cf9c768ed9c3f770765bd1c5bcc8a2c7.zip | |
54847 + 54849 (dana): skip only 88- or 256-color tests
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | Test/V15nearcolor.ztst | 48 |
2 files changed, 39 insertions, 14 deletions
@@ -1,3 +1,8 @@ +2026-07-01 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> + + * 54847 + 54849: Test/V15nearcolor.ztst: skip only 88 or 256 + color tests if corresponding terminal is not available + 2026-06-30 dana <dana@dana.is> * unposted: Completion/Unix/Command/_nano: fix syntaxes tag diff --git a/Test/V15nearcolor.ztst b/Test/V15nearcolor.ztst index aa09cb87c..52c6ab2f1 100644 --- a/Test/V15nearcolor.ztst +++ b/Test/V15nearcolor.ztst @@ -6,32 +6,44 @@ ZTST_unimplemented='the zsh/nearcolor module is not available' elif ! zmodload -s zsh/terminfo; then ZTST_unimplemented='the zsh/terminfo module is not available' - elif ! ( TERM=xterm-88color; [[ $terminfo[colors] == 88 ]] ) 2> /dev/null; then - ZTST_unimplemented='the xterm-88color terminal definition is not available' - elif ! ( TERM=xterm-256color; [[ $terminfo[colors] == 256 ]] ) 2> /dev/null; then - ZTST_unimplemented='the xterm-256color terminal definition is not available' fi - typeset -a .term.extensions=( ) + + term88= term256= + local t + for t in xterm-88color rxvt-unicode rxvt-88color; do + if ( TERM=$t; [[ $terminfo[colors] == 88 ]] ) 2> /dev/null; then + term88=$t + break + fi + done + for t in xterm-256color rxvt-256color; do + if ( TERM=$t; [[ $terminfo[colors] == 256 ]] ) 2> /dev/null; then + term256=$t + break + fi + done + if [[ -z $term88 && -z $term256 ]]; then + ZTST_unimplemented='no 88- and 256-color terminals' + else + print -u $ZTST_fd "88-color terminal: ${term88:-not found}" + print -u $ZTST_fd "256-color terminal: ${term256:-not found}" + fi %test - for 1 in xterm-{88,256}color; do + for 1 in $term88 $term256; do for 2 in '' -truecolor; do ( TERM=$1 typeset -a .term.extensions=( $2 ) zmodload -iu zsh/nearcolor zmodload | grep -q zsh/nearcolor && echo unexpectedly loaded : ${(%):-'%F{#123456}'} - zmodload | grep zsh/nearcolor + zmodload | grep -q zsh/nearcolor || echo not autoloaded ); done done 0:automatically loaded without truecolor extension ->zsh/nearcolor ->zsh/nearcolor ->zsh/nearcolor ->zsh/nearcolor - for 1 in xterm-{88,256}color; do ( + for 1 in $term88 $term256; do ( TERM=$1 typeset -a .term.extensions=( truecolor ) zmodload -iu zsh/nearcolor @@ -42,12 +54,16 @@ 1:not automatically loaded with truecolor extension # see https://github.com/exg/rxvt-unicode/blob/5865a435983be27c/src/init.C#L213 + if [[ -z $term88 ]]; then + ZTST_skip='88-color conversion (no 88-color terminal)' + else ( - TERM=xterm-88color + TERM=$term88 for 1 in 123456 654321 8a6cb4 8bffcd a5e02d cccccc d0d0d0 f00 0f0 00f; do print -r - $1 ${(V)${(%):-"%F{#$1}"}} done ) + fi 0:88-colour conversion >123456 ^[[38;5;80m >654321 ^[[38;5;81m @@ -61,12 +77,16 @@ >00f ^[[38;5;19m # see https://github.com/exg/rxvt-unicode/blob/5865a435983be27c/src/init.C#L293 + if [[ -z $term256 ]]; then + ZTST_skip='256-color conversion (no 256-color terminal)' + else ( - TERM=xterm-256color + TERM=$term256 for 1 in 123456 654321 87af5f 8a6cb4 a5e02d cccccc d0d0d0 f00 0f0 00f; do print -r - $1 ${(V)${(%):-"%F{#$1}"}} done ) + fi 0:256-colour conversion >123456 ^[[38;5;24m >654321 ^[[38;5;95m |
