summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNils Dagsson Moskopp <nils@dieweltistgarnichtso.net>2018-10-18 17:10:03 +0200
committerNils Dagsson Moskopp <nils@dieweltistgarnichtso.net>2018-10-18 17:10:03 +0200
commit0703144d9083cc23a38fe6e49e532f0bdddef22b (patch)
treeaad970124010be119c17370a431c8aea34c31b0c
parentba56beab291152581e2e525f42247f01200dfe9a (diff)
+ test handling of dofiles that write to $3 or stdout
-rw-r--r--stdout-and-$3/all.do14
-rw-r--r--stdout-and-$3/param3.do2
-rw-r--r--stdout-and-$3/stdout.do2
3 files changed, 18 insertions, 0 deletions
diff --git a/stdout-and-$3/all.do b/stdout-and-$3/all.do
index a6d65eb..767863e 100644
--- a/stdout-and-$3/all.do
+++ b/stdout-and-$3/all.do
@@ -1,4 +1,18 @@
#!/bin/sh
+[ -e stdout ] && rm stdout
+redo-ifchange stdout
+read -r STDOUT <stdout
+[ "${STDOUT}" = "stdout" ] \
+ && printf >&2 'PASS: Write to stdout possible.\n' \
+ || printf >&2 'FAIL: Write to stdout impossible.\n'
+
+[ -e param3 ] && rm param3
+redo-ifchange param3
+read -r PARAM3 <param3
+[ "${PARAM3}" = "param3" ] \
+ && printf >&2 'PASS: Write to $3 possible.\n' \
+ || printf >&2 'FAIL: Write to $3 impossible.\n'
+
redo-ifchange bogus \
&& printf >&2 'FAIL: Write to $3 and stdout possible.\n' \
|| printf >&2 'PASS: Write to $3 and stdout impossible.\n'
diff --git a/stdout-and-$3/param3.do b/stdout-and-$3/param3.do
new file mode 100644
index 0000000..3333254
--- /dev/null
+++ b/stdout-and-$3/param3.do
@@ -0,0 +1,2 @@
+#!/bin/sh
+printf 'param3\n' >${3}
diff --git a/stdout-and-$3/stdout.do b/stdout-and-$3/stdout.do
new file mode 100644
index 0000000..0c9c3c8
--- /dev/null
+++ b/stdout-and-$3/stdout.do
@@ -0,0 +1,2 @@
+#!/bin/sh
+printf 'stdout\n'