summaryrefslogtreecommitdiff
path: root/tests/misc/head-c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2001-08-18 09:20:03 +0000
committerJim Meyering <jim@meyering.net>2001-08-18 09:20:03 +0000
commit99d96a6ba356cbcb8f078754b7d64db0c95e50c0 (patch)
treea191c1c52305ca26bc0d6b0c181106d9ba542302 /tests/misc/head-c
parentb87e838b0503f91b82077b73a9fabb5bec05c309 (diff)
downloadcoreutils-99d96a6ba356cbcb8f078754b7d64db0c95e50c0.tar.xz
*** empty log message ***
Diffstat (limited to 'tests/misc/head-c')
-rwxr-xr-xtests/misc/head-c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/misc/head-c b/tests/misc/head-c
new file mode 100755
index 000000000..14f2a2f09
--- /dev/null
+++ b/tests/misc/head-c
@@ -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