From 9dc90567e3470d92dfcaaa22578e00f80ffeafe6 Mon Sep 17 00:00:00 2001 From: Michael Aquilina Date: Mon, 15 Jul 2019 12:05:13 +0100 Subject: [PATCH] Format + add tests --- auto-notify.plugin.zsh | 4 +++- tests/test_auto_notify.zunit | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/auto-notify.plugin.zsh b/auto-notify.plugin.zsh index 7dc51a3..73e08b2 100644 --- a/auto-notify.plugin.zsh +++ b/auto-notify.plugin.zsh @@ -9,7 +9,9 @@ AUTO_COMMAND_START=0 # Threshold for when to automatically show a notification export AUTO_NOTIFY_THRESHOLD=5 # List of commands/programs to ignore sending notifications for -export AUTO_NOTIFY_IGNORE=("vim" "nvim" "emacs" "less" "more" "man" "tig" "watch") +export AUTO_NOTIFY_IGNORE=( + "vim" "nvim" "emacs" "less" "more" "man" "tig" "watch" "git commit" +) autoload -Uz add-zsh-hook diff --git a/tests/test_auto_notify.zunit b/tests/test_auto_notify.zunit index cd82c4e..c14c218 100644 --- a/tests/test_auto_notify.zunit +++ b/tests/test_auto_notify.zunit @@ -51,6 +51,18 @@ } @test 'auto-notify-send does not send notification for ignored commands' { + for command in $AUTO_NOTIFY_IGNORE; do + AUTO_COMMAND="somealias" + AUTO_COMMAND_FULL="$command" + AUTO_COMMAND_START=11000 + run _auto_notify_send + + assert $state equals 0 + assert "$output" is_empty + done +} + +@test 'auto-notify-send does not send notification for ignored commands with arguments' { for command in $AUTO_NOTIFY_IGNORE; do AUTO_COMMAND="somealias bar -r" AUTO_COMMAND_FULL="$command bar -r"