Small file test cleanup

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
Anna Schumaker 2014-03-05 20:41:05 -05:00 committed by Anna Schumaker
parent 972eb3c2aa
commit 0386b24309
1 changed files with 8 additions and 4 deletions

View File

@ -8,6 +8,12 @@ function test_file
test_equal "./src/file.run $1" "$2"
}
function test_chmod
{
touch $2
chmod $1 $2
}
###
@ -50,8 +56,7 @@ rm $DATA_DIR/*
# Test opening for read
test_file "-D -o R file.txt" "ERROR: File does not exist"
touch $DATA_DIR/file.txt
chmod -r $DATA_DIR/file.txt
test_chmod -r $DATA_DIR/file.txt
test_file "-D -o R file.txt" "ERROR: File could not be opened for reading"
rm -r $DATA_DIR
@ -63,8 +68,7 @@ test_file "-D -o W file.txt" "ERROR: Could not make directory"
rm $DATA_DIR
mkdir -p $DATA_DIR
touch $DATA_DIR/file.txt
chmod -w $DATA_DIR/file.txt
test_chmod -w $DATA_DIR/file.txt
test_file "-D -o W file.txt" "ERROR: Could not open file for writing"
rm -rf $DATA_DIR