Add another test
This commit is contained in:
parent
c3acf30c66
commit
741f349028
1
tag.sh
1
tag.sh
|
@ -150,6 +150,7 @@ add_path() {
|
|||
COLUMN="filename,path"
|
||||
FILES=()
|
||||
for FILE in "$@"; do
|
||||
[ ! -f "$FILE" ] && fail "File '$FILE' does not exist in the specified path."
|
||||
local FILENAME=$(basename "$FILE")
|
||||
local FILEPATH=$(realpath $(dirname "$FILE"))
|
||||
file_exists_in_db "$FILE" && fail "File '$FILE' already exists in database."
|
||||
|
|
|
@ -15,6 +15,7 @@ oneTimeTearDown() {
|
|||
# runs one-time teardown two times
|
||||
# see https://github.com/kward/shunit2/issues/112
|
||||
[ -f "$DB_FILE" ] && rm "$DB_FILE"
|
||||
rm "$FILENAME"
|
||||
}
|
||||
|
||||
testDbCreated() {
|
||||
|
@ -27,7 +28,13 @@ testTagAdded() {
|
|||
assertEquals $RESULT "hello"
|
||||
}
|
||||
|
||||
testFailAddingNonexistentFile() {
|
||||
tag --db "$DB_FILE" import "$FILENAME" 2>/dev/null
|
||||
assertEquals "$?" 1
|
||||
}
|
||||
|
||||
testFilenameAdded() {
|
||||
touch "$FILENAME"
|
||||
tag --db "$DB_FILE" add path "$FILENAME" >/dev/null
|
||||
RESULT=$(sqlite3 "$DB_FILE" "SELECT filename from files WHERE filename = '$FILENAME'")
|
||||
assertEquals "$RESULT" "$FILENAME"
|
||||
|
|
Loading…
Reference in New Issue