summaryrefslogtreecommitdiff
path: root/rust-mode-tests.el
diff options
context:
space:
mode:
authorMicah Chalmer <micah@micahchalmer.net>2015-06-08 01:25:36 -0400
committerMicah Chalmer <micah@micahchalmer.net>2015-06-08 01:50:02 -0400
commit9d773b42d7345d8402426eb89070e0f374031d44 (patch)
tree9897c7a87d639c014f0b78024600933ac0a975b6 /rust-mode-tests.el
parent86db9bdb55e9812425f4c9ece47b1bc2b5dd836b (diff)
downloadrust-mode-9d773b42d7345d8402426eb89070e0f374031d44.tar.gz
Fix multi-line raw strings when editing
Diffstat (limited to 'rust-mode-tests.el')
-rw-r--r--rust-mode-tests.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index bb40781..b40aed0 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -1067,6 +1067,24 @@ 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 indent-method-chains-no-align ()
(let ((rust-indent-method-chain nil)) (test-indent
"