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

fix(test): fix inconsistent test

This commit is contained in:
kevin zhuang 2020-06-22 12:25:17 +10:00
parent c2026fbdbb
commit 1af316c608
2 changed files with 14 additions and 6 deletions

View File

@ -42,7 +42,7 @@ invalid_command() {
[ "${lines[0]}" = "Usage: dotbare fadd [-h] [-f] [-d] ..." ]
}
@test "main routing" {
@test "main routing2" {
run routing2
[ "${status}" -eq 0 ]
[ "${lines[0]}" = "Usage: dotbare flog [-h] [-r] [-R] [-e] [-c] ..." ]

View File

@ -36,19 +36,27 @@ select_files() {
@test "freset select commit" {
run select_commit
result=$(echo "${lines[0]}" | tr '`' "'")
if ! "${BATS_TEST_DIRNAME}"/../dotbare log &>/dev/null; then
[ "${lines[0]}" = "fatal: your current branch 'master' does not have any commits yet" ]
else
result=$(echo "${lines[0]}" | tr '`' "'")
[ "${result}" = "error: unknown option 'no-multi'" ]
fi
[ "${status}" -eq 129 ]
[ "${result}" = "error: unknown option 'no-multi'" ]
}
@test "freset no selection made" {
run no_selection_made
echo "${output}" >&3
[ "${status}" -eq 1 ]
}
@test "freset select files" {
run select_files
echo "${output}" >&3
[ "${status}" -eq 0 ]
if ! "${BATS_TEST_DIRNAME}"/../dotbare log &>/dev/null; then
[ "${status}" -eq 128 ]
[ "${lines[0]}" = "fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree." ]
else
[ "${status}" -eq 0 ]
[ -z "${output}" ]
fi
}