From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id BC9BC15812E for ; Sat, 10 Jun 2023 04:22:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0B2BEE0950; Sat, 10 Jun 2023 04:22:06 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E1EE1E094E for ; Sat, 10 Jun 2023 04:22:05 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 0103E335D6F for ; Sat, 10 Jun 2023 04:22:05 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 68F77A92 for ; Sat, 10 Jun 2023 04:22:02 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1686349547.de41ef45b33e645d04756c3a7dba2230f847eb0f.sam@gentoo> Subject: [gentoo-commits] proj/gentoo-functions:master commit in: / X-VCS-Repository: proj/gentoo-functions X-VCS-Files: test-functions X-VCS-Directories: / X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: de41ef45b33e645d04756c3a7dba2230f847eb0f X-VCS-Branch: master Date: Sat, 10 Jun 2023 04:22:02 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 4d715b2f-df9e-45f4-9af9-c2de3ed5d7e0 X-Archives-Hash: 83b16c5eed72590ebdca79e609188aa7 commit: de41ef45b33e645d04756c3a7dba2230f847eb0f Author: Kerin Millar plushkava net> AuthorDate: Fri Jun 9 22:10:04 2023 +0000 Commit: Sam James gentoo org> CommitDate: Fri Jun 9 22:25:47 2023 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=de41ef45 test-functions: Add a test for the _update_cursor_coords() function Signed-off-by: Kerin Millar plushkava.net> test-functions | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test-functions b/test-functions index 0fd998d..9f87e98 100755 --- a/test-functions +++ b/test-functions @@ -303,6 +303,27 @@ test_is_visible() { iterate_tests 2 "$@" } +test_update_cursor_coords() { + if _has_dumb_terminal; then + printf '1..0 # TERM defines the terminal as being dumb\n' + elif ! ctty=$(ps -p "$$" -otty= 2>/dev/null) || [ -z "${ctty}" ]; then + printf '1..0 # the ps(1) implementation is defective or non-compliant\n' + elif [ "${ctty}" = "?" ]; then + printf '1..0 # no controlling terminal is available\n' + elif [ ! -e /dev/tty ]; then + printf '1..0 # the /dev/tty character device is missing\n' + elif ! _update_winsize /dev/tty; then + printf '1..1\n' + printf 'not ok 1 - ecm48-cpr failed\n' + false + else + printf '1..1\n' + printf 'ok 1 - ecm48-cpr succeeded (x = %d, y = %d)\n' "${genfun_x}" "${genfun_y}" + fi +} + test_yesno() { set -- \ 0 yes \ @@ -430,6 +451,7 @@ test_esyslog || rc=1 test_is_identifier || rc=1 test_is_int || rc=1 test_is_visible || rc=1 +test_update_cursor_coords || rc=1 test_yesno || rc=1 cleanup_tmpdir exit "${rc}"