summaryrefslogtreecommitdiff
path: root/gnulib/tests/test-perror.sh
diff options
context:
space:
mode:
Diffstat (limited to 'gnulib/tests/test-perror.sh')
m---------gnulib0
-rwxr-xr-xgnulib/tests/test-perror.sh27
2 files changed, 27 insertions, 0 deletions
diff --git a/gnulib b/gnulib
deleted file mode 160000
-Subproject 4fc10daa05477586fea99b6b3ca02a87d1102fa
diff --git a/gnulib/tests/test-perror.sh b/gnulib/tests/test-perror.sh
new file mode 100755
index 00000000..f2c8fdc3
--- /dev/null
+++ b/gnulib/tests/test-perror.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+# Test NULL prefix. Result should not contain a number.
+tmpfiles="$tmpfiles t-perror.tmp"
+./test-perror${EXEEXT} 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror.tmp
+if grep '[0-9]' t-perror.tmp > /dev/null; then
+ rm -fr $tmpfiles; exit 1
+fi
+
+# Test empty prefix. Result should be the same.
+tmpfiles="$tmpfiles t-perror1.tmp"
+./test-perror${EXEEXT} '' 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror1.tmp
+diff t-perror.tmp t-perror1.tmp
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+# Test non-empty prefix.
+tmpfiles="$tmpfiles t-perror2.tmp t-perror3.tmp"
+./test-perror${EXEEXT} 'foo' 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror3.tmp
+sed -e 's/^/foo: /' < t-perror.tmp > t-perror2.tmp
+diff t-perror2.tmp t-perror3.tmp
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+rm -fr $tmpfiles
+exit 0