From 8e8b9865d18d1ecba7b9051fb21d759893462fb2 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 6 Jul 2022 09:02:12 +0100 Subject: [PATCH] Add hyperlink test, from Jeff Chiang. --- regress/capture-pane-hyperlink.sh | 30 ++++++++++++++++++++++++++++++ regress/capture-pane-sgr0.sh | 4 ++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 regress/capture-pane-hyperlink.sh diff --git a/regress/capture-pane-hyperlink.sh b/regress/capture-pane-hyperlink.sh new file mode 100644 index 00000000..681a8e17 --- /dev/null +++ b/regress/capture-pane-hyperlink.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +# capture-pane -e for OSC 8 hyperlink + +PATH=/bin:/usr/bin +TERM=screen + +[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux) +TMUX="$TEST_TMUX -Ltest" +TMP=$(mktemp) +TMP2=$(mktemp) +trap "rm -f $TMP $TMP2" 0 1 15 +$TMUX kill-server 2>/dev/null + +do_test() { + $TMUX -f/dev/null new -d " + printf '$1' + $TMUX capturep -peS0 -E1 >$TMP" + echo $2 > $TMP2 + sleep 1 + cmp $TMP $TMP2 || exit 1 + return 0 +} + +do_test '\033]8;id=1;https://github.com\033\\test1\033]8;;\033\\\n' '\033]8;id=1;https://github.com\033\\test1\033]8;;\033\\\n' || exit 1 +do_test '\033]8;;https://github.com/tmux/tmux\033\\test1\033]8;;\033\\\n' '\033]8;;https://github.com/tmux/tmux\033\\test1\033]8;;\033\\\n' || exit 1 + +$TMUX has 2>/dev/null && exit 1 + +exit 0 diff --git a/regress/capture-pane-sgr0.sh b/regress/capture-pane-sgr0.sh index 0dd9cd82..6a19ac8a 100644 --- a/regress/capture-pane-sgr0.sh +++ b/regress/capture-pane-sgr0.sh @@ -22,8 +22,8 @@ $TMUX -f/dev/null new -d " sleep 1 ( - printf '\033[1m\033[31m\033[42mabc\033[0m\033[31m\033[49mdef\033[39m\n' - printf '\033[100m bright bg \033[49m\n' + printf '\033[1m\033[31m\033[42mabc\033[0m\033[31m\033[49mdef\n' + printf '\033[39m\033[100m bright bg\n' ) | cmp - $TMP || exit 1 $TMUX has 2>/dev/null && exit 1