You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dotbare/tests/dotbare.bats

60 lines
1.1 KiB
Plaintext

4 years ago
#!/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
}
routing2() {
"${BATS_TEST_DIRNAME}"/../dotbare flog -h
}
4 years ago
normal_git() {
"${BATS_TEST_DIRNAME}"/../dotbare add -h
4 years ago
}
invalid_command() {
"${BATS_TEST_DIRNAME}"/../dotbare hello
}
4 years ago
@test "main help" {
4 years ago
run help
[ "${status}" -eq 0 ]
[ "${lines[0]}" = "Usage: dotbare [-h] [COMMANDS] [OPTIONS] ..." ]
}
4 years ago
@test "main disable add --all" {
4 years ago
run addall
[ "${status}" -eq 1 ]
[ "${lines[0]}" = "If you intend to stage all modified file, run dotbare add -u" ]
}
4 years ago
@test "main routing" {
4 years ago
run routing
[ "${status}" -eq 0 ]
[ "${lines[0]}" = "Usage: dotbare fadd [-h] [-f] [-d] ..." ]
}
@test "main routing2" {
run routing2
[ "${status}" -eq 0 ]
[ "${lines[0]}" = "Usage: dotbare flog [-h] [-r] [-R] [-e] [-c] ..." ]
}
4 years ago
@test "main git command" {
4 years ago
run normal_git
[ "${status}" -eq 129 ]
4 years ago
}
4 years ago
@test "main invliad command" {
4 years ago
run invalid_command
[ "${status}" -eq 1 ]
}