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

52 lines
1.0 KiB
Plaintext
Raw Normal View History

2020-05-13 03:41:58 +00:00
#!/usr/bin/env bats
help() {
bash "${BATS_TEST_DIRNAME}"/../dotbare freset -h
}
invalid_option() {
bash "${BATS_TEST_DIRNAME}"/../dotbare freset -p
}
2020-06-22 01:19:27 +00:00
no_selection_made() {
bash "${BATS_TEST_DIRNAME}"/../dotbare freset
}
select_commit() {
2020-06-24 23:49:13 +00:00
export PATH="${BATS_TEST_DIRNAME}:$PATH"
2020-06-22 01:19:27 +00:00
bash "${BATS_TEST_DIRNAME}"/../dotbare freset --commit -y
}
select_files() {
2020-06-24 23:49:13 +00:00
export PATH="${BATS_TEST_DIRNAME}:$PATH"
2020-06-22 01:19:27 +00:00
bash "${BATS_TEST_DIRNAME}"/../dotbare freset
}
2020-05-13 03:41:58 +00:00
@test "freset help" {
run help
[ "${status}" -eq 0 ]
2020-06-22 01:19:27 +00:00
[ "${lines[0]}" = "Usage: dotbare freset [-h] [-c] [-S] [-H] [-y] ..." ]
2020-05-13 03:41:58 +00:00
}
@test "freset invalid option" {
run invalid_option
[ "${status}" -eq 1 ]
2020-06-22 01:19:27 +00:00
[ "${lines[0]}" = "Invalid option: -p" ]
}
2020-06-23 08:10:47 +00:00
@test "freset no selection made" {
run no_selection_made
[ "${status}" -eq 1 ]
}
2020-06-22 01:19:27 +00:00
@test "freset select commit" {
2020-06-24 23:49:13 +00:00
run select_commit
2020-07-07 05:06:12 +00:00
[[ "${output}" =~ "reset freset_commit --mixed" ]]
2020-06-22 01:19:27 +00:00
}
@test "freset select files" {
2020-06-24 23:49:13 +00:00
run select_files
2020-07-07 05:06:12 +00:00
[[ "${output}" =~ "reset" ]]
[[ "${output}" =~ "freset_file" ]]
2020-05-13 03:41:58 +00:00
}