aboutsummaryrefslogtreecommitdiff
path: root/tests/100-cannot_open_files.sh
diff options
context:
space:
mode:
authorJan Sucan <jan@jansucan.com>2022-03-05 12:33:14 +0100
committerJan Sucan <jan@jansucan.com>2022-03-05 12:37:19 +0100
commit1d1d8bdb3486bc55c21b0b98458a8ffd594ef5ac (patch)
tree884bf2ed36009697bdc005d79eed3ab419dd2377 /tests/100-cannot_open_files.sh
parent752230d7288cd8efd7606f7c4032077590fbac0f (diff)
tests: Add a test for opening files
Diffstat (limited to 'tests/100-cannot_open_files.sh')
-rw-r--r--tests/100-cannot_open_files.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/100-cannot_open_files.sh b/tests/100-cannot_open_files.sh
new file mode 100644
index 0000000..4b49acd
--- /dev/null
+++ b/tests/100-cannot_open_files.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+source ./assert.sh
+
+PROGRAM_EXEC="$1"
+
+rm -f input ref out
+touch ref out
+assert_error "cannot open input file" $PROGRAM_EXEC input ref out
+
+rm -f input ref out
+touch input out
+assert_error "cannot open reference file" $PROGRAM_EXEC input ref out
+
+rm -f input ref out
+rmdir outdir 2>/dev/null
+touch input ref
+mkdir outdir
+chmod -w outdir
+assert_error "cannot open output file" $PROGRAM_EXEC input ref outdir/out
+
+rm -f input ref out
+rmdir outdir
+
+exit 0