summaryrefslogtreecommitdiff
path: root/tests/misc
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-02-11 10:55:51 +0000
committerJim Meyering <jim@meyering.net>2002-02-11 10:55:51 +0000
commit5ec71c5990c7f30a5b9c97fb6d77e8eb340f58fc (patch)
treeb3c5bd8ff112cc3ee58d5b841e7906545deefc85 /tests/misc
parentf1587760e9b01abdd7ea4f90e6681d1769b12bf3 (diff)
downloadcoreutils-5ec71c5990c7f30a5b9c97fb6d77e8eb340f58fc.tar.xz
New file/test for the change of 2002-02-08.
Diffstat (limited to 'tests/misc')
-rwxr-xr-xtests/misc/head-pos34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/misc/head-pos b/tests/misc/head-pos
new file mode 100755
index 000000000..3cb3ec186
--- /dev/null
+++ b/tests/misc/head-pos
@@ -0,0 +1,34 @@
+#!/bin/sh
+# When reading a specified number of lines, ensure that the output
+# file pointer is positioned just after those lines.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ head --version
+fi
+
+pwd=`pwd`
+tmp=head-pos.$$
+trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
+trap '(exit $?); exit' 1 2 13 15
+
+framework_failure=0
+mkdir $tmp || framework_failure=1
+cd $tmp || framework_failure=1
+(echo a; echo b) > in || framework_failure=1
+
+if test $framework_failure = 1; then
+ echo '$0: failure in testing framework' 1>&2
+ (exit 1); exit
+fi
+
+fail=0
+(head -n 1 >/dev/null; cat) < in > out || fail=1
+cat <<EOF > exp
+b
+EOF
+
+cmp out exp || fail=1
+test $fail = 1 && diff out exp 2> /dev/null
+
+(exit $fail); exit