test: skip

pull/13/head
kevin zhuang 4 years ago
parent 9bf89e5518
commit 6d6b700da9

@ -1,9 +1,7 @@
#!/usr/bin/env bats
setup() {
if "${BATS_TEST_DIRNAME}"/../dotbare log &>/dev/null; then
export PATH="${BATS_TEST_DIRNAME}:$PATH"
fi
export PATH="${BATS_TEST_DIRNAME}:$PATH"
}
help() {
@ -43,48 +41,40 @@ checkout_selected_file() {
}
@test "fchekcout branch" {
run checkout_branch
if ! "${BATS_TEST_DIRNAME}"/../dotbare log &>/dev/null; then
[ "${status}" -eq 1 ]
[ -z "${output}" ]
else
result=$(echo "${output}" | tr '`' "'")
[ "${status}" -eq 129 ]
[[ "${result}" =~ "error: unknown option 'branch'" ]]
skip
fi
run checkout_branch
result=$(echo "${output}" | tr '`' "'")
[ "${status}" -eq 129 ]
[[ "${result}" =~ "error: unknown option 'branch'" ]]
}
@test "fchekcout commit" {
run checkout_commit
if ! "${BATS_TEST_DIRNAME}"/../dotbare log &>/dev/null; then
[ "${status}" -eq 1 ]
[ "${lines[0]}" = "fatal: your current branch 'master' does not have any commits yet" ]
else
result=$(echo "${lines[0]}" | tr '`' "'")
[ "${status}" -eq 129 ]
[[ "${result}" =~ "error: unknown option 'commitshow'" ]]
skip
fi
run checkout_commit
result=$(echo "${lines[0]}" | tr '`' "'")
[ "${status}" -eq 129 ]
[[ "${result}" =~ "error: unknown option 'commitshow'" ]]
}
@test "fcheckout modified" {
run checkout_modified_file
if ! "${BATS_TEST_DIRNAME}"/../dotbare log &>/dev/null; then
[ "${status}" -eq 1 ]
[ -z "${output}" ]
else
[ "${status}" -eq 1 ]
[[ "${lines[0]}" =~ "error: pathspec '$HOME/modifiedfile' did not match any file(s) known to git" ]]
skip
fi
run checkout_modified_file
[ "${status}" -eq 1 ]
[[ "${lines[0]}" =~ "error: pathspec '$HOME/modifiedfile' did not match any file(s) known to git" ]]
}
@test "fcheckout select" {
run checkout_selected_file
if ! "${BATS_TEST_DIRNAME}"/../dotbare log &>/dev/null; then
[ "${status}" -eq 1 ]
[ -z "${output}" ]
else
[[ "${lines[0]}" =~ "error: pathspec 'commitdiff' did not match any file(s) known to git" ]]
[[ "${lines[1]}" =~ "error: pathspec '$HOME/selectgitfile' did not match any file(s) known to git" ]]
[ "${status}" -eq 1 ]
skip
fi
run checkout_selected_file
[[ "${lines[0]}" =~ "error: pathspec 'commitdiff' did not match any file(s) known to git" ]]
[[ "${lines[1]}" =~ "error: pathspec '$HOME/selectgitfile' did not match any file(s) known to git" ]]
[ "${status}" -eq 1 ]
}

@ -14,9 +14,7 @@ no_file_selected() {
}
edit_commits() {
if "${BATS_TEST_DIRNAME}"/../dotbare log &>/dev/null; then
export PATH="${BATS_TEST_DIRNAME}:$PATH"
fi
export PATH="${BATS_TEST_DIRNAME}:$PATH"
bash "${BATS_TEST_DIRNAME}"/../dotbare fedit --commit
}
@ -43,14 +41,12 @@ edit_files() {
}
@test "fedit edit commits" {
run edit_commits
if ! "${BATS_TEST_DIRNAME}"/../dotbare log &>/dev/null; then
[ "${status}" -eq 1 ]
[ "${output}" = "fatal: your current branch 'master' does not have any commits yet" ]
else
[ "${status}" -eq 128 ]
[ "${lines[0]}" = "fatal: invalid upstream 'commitdiff~'" ]
skip
fi
run edit_commits
[ "${status}" -eq 128 ]
[ "${lines[0]}" = "fatal: invalid upstream 'commitdiff~'" ]
}
@test "fedit edit files" {

@ -13,16 +13,12 @@ no_selection_made() {
}
select_commit() {
if "${BATS_TEST_DIRNAME}"/../dotbare log &>/dev/null; then
export PATH="${BATS_TEST_DIRNAME}:$PATH"
fi
export PATH="${BATS_TEST_DIRNAME}:$PATH"
bash "${BATS_TEST_DIRNAME}"/../dotbare freset --commit -y
}
select_files() {
if "${BATS_TEST_DIRNAME}"/../dotbare log &>/dev/null; then
export PATH="${BATS_TEST_DIRNAME}:$PATH"
fi
export PATH="${BATS_TEST_DIRNAME}:$PATH"
bash "${BATS_TEST_DIRNAME}"/../dotbare freset
}
@ -44,24 +40,20 @@ select_files() {
}
@test "freset select commit" {
run select_commit
if ! "${BATS_TEST_DIRNAME}"/../dotbare log &>/dev/null; then
[[ "${lines[0]}" =~ "fatal: your current branch 'master' does not have any commits yet" ]]
[ "${status}" -eq 1 ]
else
result=$(echo "${lines[0]}" | tr '`' "'")
[[ "${result}" =~ "error: unknown option 'commitshow'" ]]
[ "${status}" -eq 129 ]
skip
fi
run select_commit
result=$(echo "${lines[0]}" | tr '`' "'")
[[ "${result}" =~ "error: unknown option 'commitshow'" ]]
[ "${status}" -eq 129 ]
}
@test "freset select files" {
run select_files
if ! "${BATS_TEST_DIRNAME}"/../dotbare log &>/dev/null; then
[ "${status}" -eq 1 ]
[ -z "${output}" ]
else
[ "${status}" -eq 128 ]
[[ "${lines[0]}" =~ "fatal: ambiguous argument '$HOME/modifiedfile': unknown revision or path not in the working tree" ]]
skip
fi
run select_files
[ "${status}" -eq 128 ]
[[ "${lines[0]}" =~ "fatal: ambiguous argument '$HOME/modifiedfile': unknown revision or path not in the working tree" ]]
}

Loading…
Cancel
Save