summaryrefslogtreecommitdiff
path: root/rust-mode-tests.el
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2017-04-11 10:45:19 -0400
committerGitHub <noreply@github.com>2017-04-11 10:45:19 -0400
commit4d651ab274ad41865c31405c70464cbd6f862f06 (patch)
tree859f0ac7c09a6551763248480fa9e1847da53e32 /rust-mode-tests.el
parenta436945f788e153474c0ec149a565993804fc6a5 (diff)
parentee7043b56d232b1d5fa5601d34bd15652614cea0 (diff)
downloadrust-mode-4d651ab274ad41865c31405c70464cbd6f862f06.tar.gz
Merge pull request #197 from tromey/syntax-propertize
Syntax propertize
Diffstat (limited to 'rust-mode-tests.el')
-rw-r--r--rust-mode-tests.el67
1 files changed, 2 insertions, 65 deletions
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index f7c2a91..9c9a4d6 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -309,9 +309,6 @@ very very very long string
deindented
1
(lambda ()
- ;; The indentation will fail in some cases if the syntax properties are
- ;; not set. This only happens when font-lock fontifies the buffer.
- (font-lock-fontify-buffer)
(indent-region 1 (+ 1 (buffer-size))))
indented)))
@@ -951,7 +948,7 @@ Convert the line-column information from that list into a buffer position value.
;;; FIXME: Maybe add an ERT explainer function (something that shows the
;;; surrounding code of the final point, not just the position).
-(defun rust-test-motion (source-code init-pos final-pos manip-func &optional &rest args)
+(defun rust-test-motion (source-code init-pos final-pos manip-func &rest args)
"Test that MANIP-FUNC moves point from INIT-POS to FINAL-POS.
If ARGS are provided, send them to MANIP-FUNC.
@@ -960,12 +957,11 @@ INIT-POS, FINAL-POS are position symbols found in `rust-test-positions-alist'."
(with-temp-buffer
(rust-mode)
(insert source-code)
- (font-lock-fontify-buffer)
(goto-char (rust-get-buffer-pos init-pos))
(apply manip-func args)
(should (equal (point) (rust-get-buffer-pos final-pos)))))
-(defun rust-test-region (source-code init-pos reg-beg reg-end manip-func &optional &rest args)
+(defun rust-test-region (source-code init-pos reg-beg reg-end manip-func &rest args)
"Test that MANIP-FUNC marks region from REG-BEG to REG-END.
INIT-POS is the initial position of point.
@@ -974,7 +970,6 @@ All positions are position symbols found in `rust-test-positions-alist'."
(with-temp-buffer
(rust-mode)
(insert source-code)
- (font-lock-fontify-buffer)
(goto-char (rust-get-buffer-pos init-pos))
(apply manip-func args)
(should (equal (list (region-beginning) (region-end))
@@ -1377,24 +1372,6 @@ this_is_not_a_string();)"
"r\" this is a comment\n" font-lock-comment-face
"\"this is a string\"" font-lock-string-face)))
-(ert-deftest font-lock-raw-string-constant ()
- ;; There was an issue in which a multi-line raw string would be fontified
- ;; correctly if inserted, but then incorrectly if one of the lines was then
- ;; edited. This test replicates how font-lock responds when text in the
- ;; buffer is modified in order to reproduce it.
- (with-temp-buffer
- (rust-mode)
- (font-lock-fontify-buffer)
- (insert "const BOO:&str = r#\"\nBOO\"#;")
- (beginning-of-buffer)
- (insert " ")
- (font-lock-after-change-function 1 2 0)
-
- (should (equal 'font-lock-string-face (get-text-property 19 'face))) ;; Opening "r" of raw string
- (should (equal 'font-lock-string-face (get-text-property 27 'face))) ;; Closing "#" of raw string
- (should (equal nil (get-text-property 28 'face))) ;; Semicolon--should not be part of the string
- ))
-
(ert-deftest font-lock-runaway-raw-string ()
(rust-test-font-lock
"const Z = r#\"my raw string\";\n// oops this is still in the string"
@@ -2567,34 +2544,6 @@ type Foo<T> where T: Copy = Box<T>;
'(7 9))))
-(ert-deftest font-lock-extend-region-in-string ()
-
- (with-temp-buffer
- (rust-mode)
- (insert "
-fn foo() {
- let x = r\"
-Fontification needs to include this whole string or none of it.
- \"
-}")
- (font-lock-fontify-buffer)
- (let ((font-lock-beg 13)
- (font-lock-end 42))
- (rust-font-lock-extend-region)
- (should (<= font-lock-beg 13))
- (should (>= font-lock-end 106))
- )
- (let ((font-lock-beg 42)
- (font-lock-end 108))
- (rust-font-lock-extend-region)
- (should (<= font-lock-beg 25))
- (should (>= font-lock-end 108)))
- (let ((font-lock-beg 1)
- (font-lock-end 12))
- (rust-font-lock-extend-region)
- (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"))
@@ -2618,18 +2567,6 @@ 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))))))
-
(defun test-imenu (code expected-items)
(with-temp-buffer
(rust-mode)