2
0
mirror of https://github.com/kazhala/dotbare synced 2024-11-04 06:00:45 +00:00
dotbare/tests/dotbare.bats
2020-05-13 21:04:02 +10:00

50 lines
891 B
Bash
Executable File

#!/usr/bin/env bats
help() {
bash "${BATS_TEST_DIRNAME}"/../dotbare -h
}
addall() {
bash "${BATS_TEST_DIRNAME}"/../dotbare add --all
}
routing() {
"${BATS_TEST_DIRNAME}"/../dotbare fadd -h
}
normal_git() {
"${BATS_TEST_DIRNAME}"/../dotbare add -h
}
invalid_command() {
"${BATS_TEST_DIRNAME}"/../dotbare hello
}
@test "main help" {
run help
[ "${status}" -eq 0 ]
[ "${lines[0]}" = "Usage: dotbare [-h] [COMMANDS] [OPTIONS] ..." ]
}
@test "main disable add --all" {
run addall
[ "${status}" -eq 1 ]
[ "${lines[0]}" = "If you intend to stage all modified file, run dotbare add -u" ]
}
@test "main routing" {
run routing
[ "${status}" -eq 0 ]
[ "${lines[0]}" = "Usage: dotbare fadd [-h] [-f] [-d] ..." ]
}
@test "main git command" {
run normal_git
[ "${status}" -eq 129 ]
}
@test "main invliad command" {
run invalid_command
[ "${status}" -eq 1 ]
}