2
0
mirror of https://github.com/kazhala/dotbare synced 2024-11-04 06:00:45 +00:00
dotbare/tests/fstash.bats
kevin zhuang 542bc0838c docs(changlog): update new changes
fix: test

..

test: improve wording and variable names in test

..

..
2020-06-28 14:16:24 +10:00

56 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bats
setup() {
export PATH="${BATS_TEST_DIRNAME}:$PATH"
}
help() {
bash "${BATS_TEST_DIRNAME}"/../dotbare fstash -h
}
invalid_option() {
bash "${BATS_TEST_DIRNAME}"/../dotbare fstash -w
}
stash_file() {
bash "${BATS_TEST_DIRNAME}"/../dotbare fstash -s
}
stash_delete() {
bash "${BATS_TEST_DIRNAME}"/../dotbare fstash --delete --yes
}
stash_apply() {
bash "${BATS_TEST_DIRNAME}"/../dotbare fstash --yes
}
@test "fstash help" {
run help
[ "${status}" -eq 0 ]
[ "${lines[0]}" = "Usage: dotbare fstash [-h] [-s] [-d] [-p] ..." ]
}
@test "fstash invalid option" {
run invalid_option
[ "${status}" -eq 1 ]
[ "${lines[0]}" = "Invalid option: -w" ]
}
@test "fstash stash select file" {
run stash_file
[ "${status}" -eq 1 ]
[[ "${output}" =~ "fstash_select" ]]
}
@test "fstash stash delete" {
run stash_delete
[ "${status}" -eq 1 ]
[[ "${output}" =~ "fstash_delete" ]]
}
@test "fstash apply stash" {
run stash_apply
[ "${status}" -eq 1 ]
[[ "${output}" =~ "fstash_apply" ]]
}