summaryrefslogtreecommitdiff
path: root/rust-mode-tests.el
diff options
context:
space:
mode:
authorMicah Chalmer <micah@micahchalmer.net>2015-12-15 01:18:34 -0500
committerMicah Chalmer <micah@micahchalmer.net>2015-12-15 01:18:34 -0500
commit1ceac8b6561c64a12f5e4781db1fa735ff48a201 (patch)
tree21ea5fe8e7c13e5266a3426f94dce9bd42410665 /rust-mode-tests.el
parent95d089cbc3a23c0dd23869e716520c31daefdf8f (diff)
downloadrust-mode-1ceac8b6561c64a12f5e4781db1fa735ff48a201.tar.gz
Re-fontify buffer after it is reverted
Fix #104
Diffstat (limited to 'rust-mode-tests.el')
-rw-r--r--rust-mode-tests.el23
1 files changed, 23 insertions, 0 deletions
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index cbfde96..e7a0429 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -2427,6 +2427,29 @@ Fontification needs to include this whole string or none of it.
(should (<= font-lock-beg 1))
(should (>= font-lock-end 12)))))
+(ert-deftest redo-syntax-after-change-far-from-point ()
+ (let*
+ ((tmp-file-name (make-temp-file "rust-mdoe-test-issue104"))
+ (base-contents (apply 'concat (append '("fn foo() {\n\n}\n") (make-list 500 "// More stuff...\n") '("fn bar() {\n\n}\n")))))
+ ;; Create the temp file...
+ (with-temp-file tmp-file-name
+ (insert base-contents))
+ (with-temp-buffer
+ (insert-file-contents tmp-file-name 'VISIT nil nil 'REPLACE)
+ (rust-mode)
+ (goto-char (point-max))
+ (should (= 0 (rust-paren-level)))
+ (with-temp-file tmp-file-name
+ (insert base-contents)
+ (goto-char 12) ;; On the blank line in the middle of fn foo
+ (insert " let z = 1 < 3;")
+ )
+ (revert-buffer 'IGNORE-AUTO 'NOCONFIRM 'PRESERVE-MODES)
+ (should (= 0 (rust-paren-level)))
+ )
+ )
+ )
+
;; 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)