aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools
diff options
context:
space:
mode:
authorJohan Claesson <[email protected]>2016-07-25 15:32:48 +0200
committerDan Gudmundsson <[email protected]>2016-08-31 16:40:28 +0200
commit248b703336c579db280f0d5dab71a4a9149b3b89 (patch)
tree2f5b6835ef3546b1e3a56801b8a2dac626df1990 /lib/tools
parentb5a4c4a31e06db72b84df2c40163c2944388863a (diff)
downloadotp-248b703336c579db280f0d5dab71a4a9149b3b89.tar.gz
otp-248b703336c579db280f0d5dab71a4a9149b3b89.tar.bz2
otp-248b703336c579db280f0d5dab71a4a9149b3b89.zip
Emacs: make tags unit test more robust
Diffstat (limited to 'lib/tools')
-rw-r--r--lib/tools/emacs/erlang-test.el19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/tools/emacs/erlang-test.el b/lib/tools/emacs/erlang-test.el
index adf865128f..ba6190d194 100644
--- a/lib/tools/emacs/erlang-test.el
+++ b/lib/tools/emacs/erlang-test.el
@@ -54,9 +54,20 @@ concatenated to form an erlang file to test on.")
(let* ((dir (make-temp-file "erlang-test" t))
(erlang-file (expand-file-name "erlang_test.erl" dir))
(tags-file (expand-file-name "TAGS" dir))
- tags-file-name tags-table-list erlang-buffer)
+ (old-tags-file-name (default-value 'tags-file-name))
+ (old-tags-table-list (default-value 'tags-table-list))
+ tags-file-name
+ tags-table-list
+ tags-table-set-list
+ erlang-buffer
+ erlang-mode-hook
+ prog-mode-hook
+ erlang-shell-mode-hook
+ tags-add-tables)
(unwind-protect
(progn
+ (setq-default tags-file-name nil)
+ (setq-default tags-table-list nil)
(erlang-test-create-erlang-file erlang-file)
(erlang-test-compile-tags erlang-file tags-file)
(setq erlang-buffer (find-file-noselect erlang-file))
@@ -74,7 +85,9 @@ concatenated to form an erlang file to test on.")
(when (buffer-live-p tags-buffer)
(kill-buffer tags-buffer)))
(when (file-exists-p dir)
- (delete-directory dir t)))))
+ (delete-directory dir t))
+ (setq-default tags-file-name old-tags-file-name)
+ (setq-default tags-table-list old-tags-table-list))))
(defun erlang-test-create-erlang-file (erlang-file)
(with-temp-file erlang-file
@@ -121,7 +134,7 @@ concatenated to form an erlang file to test on.")
(with-temp-buffer
(erlang-mode)
(setq-local tags-file-name tags-file)
- (insert "erlang_test:fun")
+ (insert "\nerlang_test:fun")
(erlang-complete-tag)
(should (looking-back "erlang_test:function"))
(insert "\nfun")