2
0
mirror of https://github.com/kazhala/dotbare synced 2024-11-04 06:00:45 +00:00

test(fbackup): update fbackup test

This commit is contained in:
Kevin Zhuang 2020-07-07 11:49:26 +10:00
parent 27c923a55a
commit 245b9a66a2
2 changed files with 2 additions and 13 deletions

View File

@ -89,7 +89,7 @@ cd "${DOTBARE_TREE}"
if [[ "${backup_type}" == 'select' ]]; then
selected_files=$(get_git_file "select files to backup" "raw")
else
selected_files=$(/usr/bin/git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" \
selected_files=$(git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" \
ls-files --full-name --directory "${DOTBARE_TREE}")
fi

View File

@ -32,14 +32,10 @@ move_file() {
bash "${BATS_TEST_DIRNAME}"/../dotbare fbackup --path bats_test.txt -m
}
select_file() {
export PATH="${BATS_TEST_DIRNAME}:$PATH"
bash "${BATS_TEST_DIRNAME}"/../dotbare fbackup --select
}
@test "fbackup help" {
run help
[ "${status}" -eq 0 ]
[ "${lines[0]}" = "Usage: dotbare fbackup [-h] [-m] [-s] [-p PATH] ..." ]
}
@test "fbackup invalid option" {
@ -71,10 +67,3 @@ select_file() {
[ -f "${DOTBARE_BACKUP}"/bats_test.txt ]
[ ! -f "${BATS_TEST_DIRNAME}"/bats_test.txt ]
}
@test "fbackup select file" {
run select_file
[ "${status}" -eq 1 ]
[[ "${output}" =~ 'No such file or directory' ]]
[[ "${output}" =~ 'fbackup_select_file' ]]
}