*** empty log message ***
authorJim Meyering <jim@meyering.net>
Sat, 18 Aug 2001 09:20:03 +0000 (09:20 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 18 Aug 2001 09:20:03 +0000 (09:20 +0000)
tests/misc/head-c [new file with mode: 0755]

diff --git a/tests/misc/head-c b/tests/misc/head-c
new file mode 100755 (executable)
index 0000000..14f2a2f
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+# exercize the fix of 2001-08-18, based on test case from Ian Bruce
+
+if test "$VERBOSE" = yes; then
+  set -x
+  head --version
+fi
+
+pwd=`pwd`
+tmp=head-c.$$
+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 abc > in || framework_failure=1
+
+if test $framework_failure = 1; then
+  echo 'failure in testing framework' 1>&2
+  (exit 1); exit
+fi
+
+fail=0
+
+(head -c1; head -c1) < in > out || fail=1
+case "`cat out`" in
+  ab) ;;
+  *) fail=1 ;;
+esac
+
+(exit $fail); exit