diff options
author | 2023-06-09 23:10:04 +0100 | |
---|---|---|
committer | 2023-06-09 23:25:47 +0100 | |
commit | de41ef45b33e645d04756c3a7dba2230f847eb0f (patch) | |
tree | 77cf11603c389267d568c47deb2585cda845d63e /test-functions | |
parent | test-functions: Do not silence ewarn() while testing is_older_than() (diff) | |
download | gentoo-functions-de41ef45b33e645d04756c3a7dba2230f847eb0f.tar.gz gentoo-functions-de41ef45b33e645d04756c3a7dba2230f847eb0f.tar.bz2 gentoo-functions-de41ef45b33e645d04756c3a7dba2230f847eb0f.zip |
test-functions: Add a test for the _update_cursor_coords() function
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Diffstat (limited to 'test-functions')
-rwxr-xr-x | test-functions | 22 |
1 files changed, 22 insertions, 0 deletions
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..0 # the controlling terminal is not smart\n' + elif ! _update_cursor_coords <>/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}" |