branch: externals/csharp-mode commit d85cc3d635114f149783d87d45fd464469254050 Author: Jostein Kjønigsen <jost...@kjonigsen.net> Commit: Jostein Kjønigsen <jost...@kjonigsen.net>
Add unit-test for hooks during mode-activation. --- csharp-mode-tests.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/csharp-mode-tests.el b/csharp-mode-tests.el index 0d113b4..21156ba 100644 --- a/csharp-mode-tests.el +++ b/csharp-mode-tests.el @@ -100,7 +100,7 @@ (matched-file-names (cadddr test-case)) (find-file-hook '()) ;; avoid vc-mode file-hooks when opening! (buffer (find-file-read-only file-name))) - (message (concat "Testing compilation-log: " file-name)) + (message (concat "Testing compilation-log: " file-name)) (dotimes (number times) (let* ((expected (nth number matched-file-names))) (message (concat "- Expecting match: " expected)) @@ -130,4 +130,13 @@ (result (csharp--imenu-remove-param-names-from-paramlist test-value))) (should (equal expected-value result))))) +(ert-deftest activating-mode-triggers-all-hooks () + (add-hook 'csharp-mode-hook (lambda () (setq csharp-hook1 t))) + (add-hook 'prog-mode-hook (lambda () (setq csharp-hook2 t))) + + (with-temp-buffer + (csharp-mode) + (should (equal t (and csharp-hook1 + csharp-hook2))))) + ;;(ert-run-tests-interactively t)