From 0539705768992ebcc290bc859f64e27898c7f958 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 11 Sep 2007 23:30:49 +0200 Subject: Move all tests from test/{od,sha1sum,shred,stty} to tests/misc/. Reflect these renamings: od/od-N misc/od-N od/x8 misc/od-x8 sha1sum/basic-1 misc/sha1sum sha1sum/sample-vec misc/sha1sum-vec shred/exact misc/shred-exact shred/remove misc/shred-remove stty/basic-1 misc/stty stty/invalid misc/stty-invalid stty/row-col-1 misc/stty-row-col * tests/misc/Makefile.am (TESTS): Add the new files. * tests/Makefile.am (SUBDIRS): Remove the dir names. * tests/od, tests/sha1sum, tests/shred, tests/stty: Remove the directories. * configure.ac (AC_CONFIG_FILES): Remove the corresponding Makefile names. --- tests/misc/stty-row-col | 86 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100755 tests/misc/stty-row-col (limited to 'tests/misc/stty-row-col') diff --git a/tests/misc/stty-row-col b/tests/misc/stty-row-col new file mode 100755 index 000000000..3fb387183 --- /dev/null +++ b/tests/misc/stty-row-col @@ -0,0 +1,86 @@ +#! /bin/sh +# Test "stty" with rows and columns. + +# Copyright (C) 1998-2001, 2003-2007 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +# This script takes no arguments. + +if test "$VERBOSE" = yes; then + set -x + stty --version +fi + +# Setting this envvar to a very small value used to cause e.g., `stty size' +# to generate slightly different output on certain systems. +COLUMNS=80 +export COLUMNS + +# Make sure we get English-language behavior. +# See the report about a possibly-related Solaris problem by Alexandre Peshansky +# . +# Currently stty isn't localized, but it might be in the future. +LC_ALL=C +export LC_ALL + +# Make sure there's a tty on stdin. +. $srcdir/../input-tty +. $srcdir/../test-lib.sh + +# Versions of GNU stty from shellutils-1.9.2c and earlier failed +# tests #2 and #4 when run on SunOS 4.1.3. + +tests=' +1 rows_40_columns_80 40_80 +2 rows_1_columns_1 1_1 +3 rows_40_columns_80 40_80 +4 rows_1 1_80 +5 columns_1 1_1 +6 rows_40 40_1 +7 rows_1 1_1 +8 columns_80 1_80 +9 rows_30 30_80 +NA LAST NA +' +set $tests + +saved_size=`stty size` && test -n "$saved_size" \ + || { echo "$0: skipping this test: can't get window size" 1>&2; + exit 77; exit; } + +fail=0 +while :; do + test_name=$1 + args=$2 + expected_result="`echo $3|tr _ ' '`" + test "$args" = empty && args='' + test "x$args" = xLAST && break + args=`echo x$args|tr _ ' '|sed 's/^x//'` + if test "$VERBOSE" = yes; then + # echo "testing \`stty $args; stty size\` = $expected_result ..." + echo "test $test_name... " | tr -d '\n' + fi + stty $args || exit 1 + test x"`stty size 2> /dev/null`" = "x$expected_result" \ + && ok=ok || ok=FAIL fail=1 + test "$VERBOSE" = yes && echo $ok + shift; shift; shift +done + +set x $saved_size +stty rows $2 columns $3 || exit 1 + +exit $fail -- cgit v1.2.3-54-g00ecf