2
0
mirror of https://github.com/kazhala/dotbare synced 2024-11-02 09:40:27 +00:00
dotbare/tests/funtrack.bats
kevin zhuang 542bc0838c docs(changlog): update new changes
fix: test

..

test: improve wording and variable names in test

..

..
2020-06-28 14:16:24 +10:00

56 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bats
setup() {
export PATH="${BATS_TEST_DIRNAME}:$PATH"
}
help() {
bash "${BATS_TEST_DIRNAME}"/../dotbare funtrack -h
}
invalid_option() {
bash "${BATS_TEST_DIRNAME}"/../dotbare funtrack -p
}
untrack_file() {
bash "${BATS_TEST_DIRNAME}"/../dotbare funtrack --yes
}
temp_untrack() {
bash "${BATS_TEST_DIRNAME}"/../dotbare funtrack --yes -t
}
resume_track() {
bash "${BATS_TEST_DIRNAME}"/../dotbare funtrack --yes --resume
}
@test "funtrack help" {
run help
[ "${status}" -eq 0 ]
[ "${lines[0]}" = "Usage: dotbare funtrack [-h] [-t] [-r] [-y] ..." ]
}
@test "funtrack invalid option" {
run invalid_option
[ "${status}" -eq 1 ]
[ "${lines[0]}" = "Invalid option: -p" ]
}
@test "funtrack untrack file" {
run untrack_file
[ "${status}" -eq 128 ]
[[ "${output}" =~ "funtrack_file" ]]
}
@test "funtrack temp untrack" {
run temp_untrack
[ "${status}" -eq 128 ]
[[ "${output}" =~ "fatal: Unable to mark file funtrack_file" ]]
}
@test "funtrack resume track" {
run resume_track
[ "${status}" -eq 128 ]
[[ "${output}" =~ "fatal: Unable to mark file funtrack_file" ]]
}