test(fbackup): update fbackup test

pull/17/head
Kevin Zhuang 4 years ago
parent 27c923a55a
commit 245b9a66a2

@ -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

@ -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' ]]
}

Loading…
Cancel
Save