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

71 lines
1.3 KiB
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
}
2020-06-21 22:14:23 +00:00
routing2() {
"${BATS_TEST_DIRNAME}"/../dotbare flog -h
}
2020-05-13 00:39:10 +00:00
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-06-27 23:28:09 +00:00
version() {
source "${BATS_TEST_DIRNAME}"/../helper/set_variable.sh
2020-06-27 23:28:09 +00:00
"${BATS_TEST_DIRNAME}"/../dotbare --version
}
2020-05-13 03:41:58 +00:00
@test "main help" {
2020-05-13 00:39:10 +00:00
run help
[ "${status}" -eq 0 ]
2020-06-27 23:28:09 +00:00
[ "${lines[0]}" = "Usage: dotbare [-h] [-v] [COMMANDS] [OPTIONS] ..." ]
}
@test "main version" {
run version
[ "${status}" -eq 0 ]
[[ "${output}" =~ "Current dotbare version: ${DOTBARE_VERSION}" ]]
2020-05-13 00:39:10 +00:00
}
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-06-22 02:25:17 +00:00
@test "main routing2" {
2020-06-21 22:14:23 +00:00
run routing2
[ "${status}" -eq 0 ]
2020-06-25 04:34:51 +00:00
[ "${lines[0]}" = "Usage: dotbare flog [-h] [-r] [-R] [-e] [-c] [-y] ..." ]
2020-06-21 22:14:23 +00:00
}
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 ]
}