Files
bash-it/vendor/github.com/rcaloras/bash-preexec/test/include-test.bats
buhl 5ad497924c Add "preexec" from "https://github.com/rcaloras/bash-preexec@0.4.1"
git-vendor-name: preexec
git-vendor-dir: vendor/github.com/rcaloras/bash-preexec
git-vendor-repository: https://github.com/rcaloras/bash-preexec
git-vendor-ref: 0.4.1
2021-01-23 18:28:43 +01:00

21 lines
574 B
Bash

#!/usr/bin/env bats
@test "should not import if it's already defined" {
__bp_imported="defined"
source "${BATS_TEST_DIRNAME}/../bash-preexec.sh"
[ -z $(type -t __bp_preexec_and_precmd_install) ]
}
@test "should import if not defined" {
unset __bp_imported
source "${BATS_TEST_DIRNAME}/../bash-preexec.sh"
[ -n $(type -t __bp_install) ]
}
@test "bp should stop installation if HISTTIMEFORMAT is readonly" {
readonly HISTTIMEFORMAT
run source "${BATS_TEST_DIRNAME}/../bash-preexec.sh"
[ $status -ne 0 ]
[[ "$output" =~ "HISTTIMEFORMAT" ]] || return 1
}