From 1d1d8bdb3486bc55c21b0b98458a8ffd594ef5ac Mon Sep 17 00:00:00 2001 From: Jan Sucan Date: Sat, 5 Mar 2022 12:33:14 +0100 Subject: tests: Add a test for opening files --- tests/100-cannot_open_files.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/100-cannot_open_files.sh 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 -- cgit v1.2.3