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

50 lines
891 B
Plaintext
Raw Normal View History

2020-05-13 00:39:10 +00:00
#!/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() {
2020-05-13 11:04:02 +00:00
"${BATS_TEST_DIRNAME}"/../dotbare add -h
2020-05-13 00:39:10 +00:00
}
invalid_command() {
"${BATS_TEST_DIRNAME}"/../dotbare hello
}
2020-05-13 03:41:58 +00:00
@test "main help" {
2020-05-13 00:39:10 +00:00
run help
[ "${status}" -eq 0 ]
[ "${lines[0]}" = "Usage: dotbare [-h] [COMMANDS] [OPTIONS] ..." ]
}
2020-05-13 03:41:58 +00:00
@test "main disable add --all" {
2020-05-13 00:39:10 +00:00
run addall
[ "${status}" -eq 1 ]
[ "${lines[0]}" = "If you intend to stage all modified file, run dotbare add -u" ]
}
2020-05-13 03:41:58 +00:00
@test "main routing" {
2020-05-13 00:39:10 +00:00
run routing
[ "${status}" -eq 0 ]
[ "${lines[0]}" = "Usage: dotbare fadd [-h] [-f] [-d] ..." ]
}
2020-05-13 03:41:58 +00:00
@test "main git command" {
2020-05-13 00:39:10 +00:00
run normal_git
2020-05-13 11:04:02 +00:00
[ "${status}" -eq 129 ]
2020-05-13 00:39:10 +00:00
}
2020-05-13 03:41:58 +00:00
@test "main invliad command" {
2020-05-13 00:39:10 +00:00
run invalid_command
[ "${status}" -eq 1 ]
}