2
0
mirror of https://github.com/kazhala/dotbare synced 2024-11-17 21:25:32 +00:00

funtrack test

This commit is contained in:
kevin zhuang 2020-05-13 13:47:09 +10:00
parent feed88e78b
commit d09293f9bc
2 changed files with 22 additions and 1 deletions

View File

@ -23,7 +23,7 @@ source "${mydir}"/../helper/git_query.sh
source "${mydir}"/../helper/get_confirmation.sh source "${mydir}"/../helper/get_confirmation.sh
function usage() { function usage() {
echo -e "Usage: dotbare funtrack [-h] [-f] [-d] ...\n" echo -e "Usage: dotbare funtrack [-h] [-s] [-S] ...\n"
echo -e "Untrack selected files from git\n" echo -e "Untrack selected files from git\n"
echo -e "Note: by default, the untrack will remove the file from index while" echo -e "Note: by default, the untrack will remove the file from index while"
echo -e "keeping the file in your current system (git rm --cached filename)" echo -e "keeping the file in your current system (git rm --cached filename)"

21
tests/funtrack.bats Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env bats
help() {
bash "${BATS_TEST_DIRNAME}"/../dotbare funtrack -h
}
invalid_option() {
bash "${BATS_TEST_DIRNAME}"/../dotbare funtrack -p
}
@test "funtrack help" {
run help
[ "${status}" -eq 0 ]
[ "${lines[0]}" = "Usage: dotbare funtrack [-h] [-s] [-S] ..." ]
}
@test "funtrack invalid option" {
run invalid_option
[ "${status}" -eq 1 ]
[ "${lines[0]}" = "Invalid option: p" ]
}