Add option --only-data-dir (-x)

Only use the dictionaries in data-dir, do not search in user and system directories

This makes testing much easier
This commit is contained in:
Peter
2017-07-07 08:39:26 +02:00
parent f510300f59
commit 5f0f6e036f
3 changed files with 29 additions and 5 deletions

19
tests/t_only_data_dir Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/sh
set -e
SDCV="$1"
TEST_DIR="$2"
unset SDCV_PAGER
unset STARDICT_DATA_DIR
DICTS=$($SDCV -x -n -l --data-dir "$TEST_DIR" | tail -n +2 | wc -l)
# the expected result:
ACTUAL_DICTS=$(find "$TEST_DIR" -name "*.ifo" | wc -l)
if [ $DICTS -ne $ACTUAL_DICTS ]; then
echo "number of dictionaries in $TEST_DIR should be $ACTUAL_DICTS but was $DICTS according to sdcv"
exit 1
fi
exit 0