Tests for additional default config file location

This commit is contained in:
Mark Harrison
2009-06-22 22:34:45 -04:00
parent 75622c4a72
commit 98569d5f8c

View File

@@ -10,7 +10,7 @@ to find it somewhere else.
# Remove the pre-created todo.cfg to test behavior in its absence # Remove the pre-created todo.cfg to test behavior in its absence
rm -f todo.cfg rm -f todo.cfg
echo "Fatal error: Cannot read configuration file $HOME/todo.cfg" > expect echo "Fatal error: Cannot read configuration file $HOME/.todo/config" > expect
test_expect_success 'no config file' ' test_expect_success 'no config file' '
todo.sh > output 2>&1 || test_cmp expect output todo.sh > output 2>&1 || test_cmp expect output
' '
@@ -32,6 +32,15 @@ EOF
rm -f used_config rm -f used_config
test_expect_success 'config file (default location 1)' ' test_expect_success 'config file (default location 1)' '
mkdir .todo
cp test.cfg .todo/config
todo.sh > output;
test_cmp expect output && test -f used_config &&
rm -rf .todo
'
rm -f used_config
test_expect_success 'config file (default location 2)' '
cp test.cfg todo.cfg cp test.cfg todo.cfg
todo.sh > output; todo.sh > output;
test_cmp expect output && test -f used_config && test_cmp expect output && test -f used_config &&
@@ -39,7 +48,7 @@ test_expect_success 'config file (default location 1)' '
' '
rm -f used_config rm -f used_config
test_expect_success 'config file (default location 2)' ' test_expect_success 'config file (default location 3)' '
cp test.cfg .todo.cfg cp test.cfg .todo.cfg
todo.sh > output; todo.sh > output;
test_cmp expect output && test -f used_config && test_cmp expect output && test -f used_config &&