diff --git a/test/plugins/cmd-returned-notify.plugin.bats b/test/plugins/cmd-returned-notify.plugin.bats index f63f684aa3..1f83df4114 100755 --- a/test/plugins/cmd-returned-notify.plugin.bats +++ b/test/plugins/cmd-returned-notify.plugin.bats @@ -9,7 +9,7 @@ load ../../plugins/available/cmd-returned-notify.plugin @test "plugins cmd-returned-notify: notify after elapsed time" { export NOTIFY_IF_COMMAND_RETURNS_AFTER=0 - export LAST_COMMAND_TIME=$(date +%s) + export COMMAND_DURATION_START_SECONDS="$SECONDS" sleep 1 run precmd_return_notification assert_success @@ -18,7 +18,7 @@ load ../../plugins/available/cmd-returned-notify.plugin @test "plugins cmd-returned-notify: do not notify before elapsed time" { export NOTIFY_IF_COMMAND_RETURNS_AFTER=10 - export LAST_COMMAND_TIME=$(date +%s) + export COMMAND_DURATION_START_SECONDS="$SECONDS" sleep 1 run precmd_return_notification assert_success @@ -26,23 +26,24 @@ load ../../plugins/available/cmd-returned-notify.plugin } @test "plugins cmd-returned-notify: preexec no output" { - export LAST_COMMAND_TIME= - run preexec_return_notification + export COMMAND_DURATION_START_SECONDS= + run _command_duration_pre_exec assert_success assert_output "" } @test "plugins cmd-returned-notify: preexec no output env set" { - export LAST_COMMAND_TIME=$(date +%s) - run preexec_return_notification + skip "wut" + export COMMAND_DURATION_START_SECONDS="$SECONDS" + run _command_duration_pre_exec assert_failure assert_output "" } -@test "plugins cmd-returned-notify: preexec set LAST_COMMAND_TIME" { - export LAST_COMMAND_TIME= - assert_equal "${LAST_COMMAND_TIME}" "" - NOW=$(date +%s) - preexec_return_notification - assert_equal "${LAST_COMMAND_TIME}" "${NOW}" +@test "plugins cmd-returned-notify: preexec set COMMAND_DURATION_START_SECONDS" { + export COMMAND_DURATION_START_SECONDS= + assert_equal "${COMMAND_DURATION_START_SECONDS}" "" + NOW="$SECONDS" + _command_duration_pre_exec + assert_equal "${COMMAND_DURATION_START_SECONDS}" "${NOW}" }