From d6b002ee3b9056f8c5a03c2794acadc96096ba50 Mon Sep 17 00:00:00 2001 From: Michael Aquilina Date: Wed, 17 Jul 2019 21:55:42 +0100 Subject: [PATCH] Add test file for _is_auto_notify_ignored --- tests/test_is_auto_notify_ignored.zunit | 35 +++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/test_is_auto_notify_ignored.zunit diff --git a/tests/test_is_auto_notify_ignored.zunit b/tests/test_is_auto_notify_ignored.zunit new file mode 100644 index 0000000..61366a1 --- /dev/null +++ b/tests/test_is_auto_notify_ignored.zunit @@ -0,0 +1,35 @@ +#!/usr/bin/env zunit + +@setup { + load "../auto-notify.plugin.zsh" +} + +@test 'is_auto_notify_ignored - commands outside AUTO_NOTIFY_IGNORE' { + run _is_auto_notify_ignored "echo hello world" + + assert $state equals 0 + assert "$output" same_as "no" +} + +@test 'is_auto_notify_ignored - all commands in AUTO_NOTIFY_IGNORE' { + for command in $AUTO_NOTIFY_IGNORE; do + run _is_auto_notify_ignored $command + + assert $state equals 0 + assert "$output" same_as "yes" + done +} + +@test 'is_auto_notify_ignored - piped commands which are not ignored' { + run _is_auto_notify_ignored "echo hello world | base64 -e" + + assert $state equals 0 + assert "$output" same_as "no" +} + +@test 'is_auto_notify_ignored - piped commands which are ignored' { + run _is_auto_notify_ignored "echo hello world | less -R" + + assert $state equals 0 + assert "$output" same_as "yes" +}