aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorWilfred Hughes <me@wilfred.me.uk>2017-12-13 23:38:15 +0000
committerWilfred Hughes <me@wilfred.me.uk>2017-12-13 23:38:15 +0000
commit44e7d2702f55e9a5693aebfeadc6a8c5418b7c41 (patch)
tree0e65ef6cb956115e451a8815a9d26439bafe601a /test
parent518d24b76bc6e4d55c8b2c288a33faf67100b101 (diff)
Fix crash on definition of primitive variables
Diffstat (limited to 'test')
-rw-r--r--test/unit-test.el13
1 files changed, 10 insertions, 3 deletions
diff --git a/test/unit-test.el b/test/unit-test.el
index 34b1db1..69e45be 100644
--- a/test/unit-test.el
+++ b/test/unit-test.el
@@ -140,9 +140,16 @@
(setq helpful-var-without-defvar 'foo)
(ert-deftest helpful--definition ()
- "Ensure we don't crash on calling `helpful--definition' on
-variables defined without `defvar'."
- (helpful--definition 'helpful-var-without-defvar nil))
+ ;; Ensure we don't crash on calling `helpful--definition' on
+ ;; variables defined without `defvar'.
+ (helpful--definition 'helpful-var-without-defvar nil)
+ ;; Handle definitions of variables in C source code.
+ (let* ((emacs-src-path (f-join default-directory "emacs-25.3" "src")))
+ (if (f-exists-p emacs-src-path)
+ (let ((find-function-C-source-directory emacs-src-path))
+ (helpful--definition 'default-directory nil))
+ (message "No Emacs source code found at %S, skipping test."
+ emacs-src-path))))
(ert-deftest helpful-variable ()
"Smoke test for `helpful-variable'."