summaryrefslogtreecommitdiff
path: root/rust-mode-tests.el
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2016-08-18 15:26:41 -0400
committerGitHub <noreply@github.com>2016-08-18 15:26:41 -0400
commitf73f3217b24f0fb261d09c4e58a0416a42c82c77 (patch)
treeadd24c219ac5d926a0bef17590157a511e9ba8dd /rust-mode-tests.el
parentba5ff9058546df593ff7d8737fb52b5e92ad1913 (diff)
parent2540d7eff0faa7e966b6c4391e53617800275f85 (diff)
downloadrust-mode-f73f3217b24f0fb261d09c4e58a0416a42c82c77.tar.gz
Merge pull request #163 from Wilfred/preserve_point_rustfmt
Correctly restore point position after running rustfmt
Diffstat (limited to 'rust-mode-tests.el')
-rw-r--r--rust-mode-tests.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index 1e60768..3c3ba03 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -2561,6 +2561,18 @@ Fontification needs to include this whole string or none of it.
)
)
+(ert-deftest rust-test-revert-hook-preserves-point ()
+ (with-temp-buffer
+ ;; Insert some code, and put point in the middle.
+ (insert "fn foo() {}\n")
+ (insert "fn bar() {}\n")
+ (insert "fn baz() {}\n")
+ (goto-char (point-min))
+ (forward-line 1)
+ (let ((initial-point (point)))
+ (rust--after-revert-hook)
+ (should (equal initial-point (point))))))
+
;; If electric-pair-mode is available, load it and run the tests that use it. If not,
;; no error--the tests will be skipped.
(require 'elec-pair nil t)