diff --git a/conner-tests.el b/conner-tests.el index 2c4428b..babf825 100644 --- a/conner-tests.el +++ b/conner-tests.el @@ -205,10 +205,12 @@ (should-error (conner--validate-command-plist '(:name "name" :command "test" :type "invalidtype"))) (should-error (conner--validate-command-plist '(:name "name" :command "test" :type "compile" :workdir notstring))) (should-error (conner--validate-command-plist '(:name "name" :command "test" :type "compile" :environment notlist))) - (should-error (conner--validate-command-plist '(:name "name" :command "test" :type "compile" :hook "not a symbol!"))) + (should-error (conner--validate-command-plist '(:name "name" :command "test" :type "compile" :hook "not a function!"))) (should-error (conner--validate-command-plist '(:name "name" :command "test" :type "compile" :silent "not a boolean"))) (should (eq (conner--validate-command-plist '(:name "name" :command symbol :type "compile")) nil)) - (should (eq (conner--validate-command-plist '(:name "name" :command "test" :type "compile")) nil)))) + (should (eq (conner--validate-command-plist '(:name "name" :command "test" :type "compile")) nil)) + (should (eq (conner--validate-command-plist '(:name "name" :command "hook symbol" :type "compile" :hook car)) nil)) + (should (eq (conner--validate-command-plist '(:name "name" :command "hook lambda" :type "compile" :hook (lambda () t))) nil)))) (ert-deftest conner-test-hooks () (with-temp-env diff --git a/conner.el b/conner.el index 0ed953f..705ae76 100644 --- a/conner.el +++ b/conner.el @@ -185,9 +185,9 @@ If Projectile is available, it defaults to it. Otherwise, it uses (when (not (or (listp (plist-get plist :environment)) (not (plist-get plist :environment)))) (user-error "Environment is not a list")) - (when (not (or (symbolp (plist-get plist :hook)) + (when (not (or (functionp (plist-get plist :hook)) (not (plist-get plist :hook)))) - (user-error "Hook is not a symbol")) + (user-error "Hook is not a function")) (when (not (booleanp (plist-get plist :silent))) (user-error "Silent is not a boolean"))))