lib/command_duration: tests & whitespace

pull/1906/head
John D Pell 2022-01-30 16:03:58 -08:00 committed by John D Pell
parent 1c2fc2837f
commit 866e5be86b
2 changed files with 25 additions and 34 deletions

View File

@ -25,22 +25,13 @@ function local_setup_file() {
assert_output $''
}
@test "plugins cmd-returned-notify: preexec no output" {
@test "lib command_duration: preexec no output" {
export COMMAND_DURATION_START_SECONDS=
run _command_duration_pre_exec
assert_success
assert_output ""
}
@test "plugins cmd-returned-notify: preexec no output env set" {
skip "wut"
export COMMAND_DURATION_START_SECONDS="${EPOCHREALTIME:-$SECONDS}"
run _command_duration_pre_exec
assert_failure
assert_output ""
}
@test "plugins cmd-returned-notify: preexec set COMMAND_DURATION_START_SECONDS" {
@test "lib command_duration: preexec set COMMAND_DURATION_START_SECONDS" {
export COMMAND_DURATION_START_SECONDS=
assert_equal "${COMMAND_DURATION_START_SECONDS}" ""
NOW="${EPOCHREALTIME:-$SECONDS}"

View File

@ -57,7 +57,7 @@ function common_setup_file() {
function setup_libs() {
local lib
# Use a loop to allow convenient short-circuiting for some test files
for lib in "log" "utilities" "helpers" "search" "preexec" "colors"; do
for lib in "log" "utilities" "helpers" "search" "preexec" "colors" "command_duration"; do
load "${BASH_IT?}/lib/${lib}.bash" || return
# shellcheck disable=SC2015 # short-circuit if we've reached the requested library
[[ "${lib}" == "${1:-}" ]] && return 0 || true