2020-05-13 01:35:35 +00:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
help() {
|
|
|
|
bash "${BATS_TEST_DIRNAME}"/../dotbare fedit -h
|
|
|
|
}
|
|
|
|
|
|
|
|
invalid_option() {
|
|
|
|
bash "${BATS_TEST_DIRNAME}"/../dotbare fedit -p
|
|
|
|
}
|
|
|
|
|
|
|
|
no_file_selected() {
|
|
|
|
cd "${BATS_TEST_DIRNAME}"
|
|
|
|
bash "${BATS_TEST_DIRNAME}"/../dotbare fedit -m
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "fedit help" {
|
|
|
|
run help
|
|
|
|
[ "${status}" -eq 0 ]
|
2020-05-13 03:52:28 +00:00
|
|
|
[ "${lines[0]}" = "Usage: dotbare fedit [-h] [-m] [-c] ..." ]
|
2020-05-13 01:35:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "fedit invalid option" {
|
|
|
|
run invalid_option
|
|
|
|
[ "${status}" -eq 1 ]
|
|
|
|
[ "${lines[0]}" = "Invalid option: p" ]
|
|
|
|
}
|
|
|
|
|
2020-05-13 03:41:58 +00:00
|
|
|
@test "fedit no file selected" {
|
2020-05-13 01:35:35 +00:00
|
|
|
run no_file_selected
|
|
|
|
[ "${status}" -eq 1 ]
|
|
|
|
}
|