summaryrefslogtreecommitdiff
path: root/rust-mode-tests.el
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2016-01-06 09:42:28 -0500
committerNiko Matsakis <niko@alum.mit.edu>2016-01-06 09:42:28 -0500
commit2cd3cf93853fc8e46011f4d98bd95ffa695c6257 (patch)
treeb03e0b6d9fb33d7287c3867c6c77990e095705ca /rust-mode-tests.el
parent061e6d8a3a9104570144f1eacb729e3211cb03cd (diff)
parentdd6d417c1404efcf2364a61fd7e855ec134a991f (diff)
downloadrust-mode-2cd3cf93853fc8e46011f4d98bd95ffa695c6257.tar.gz
Merge pull request #116 from Wilfred/type_annotation_highlighting
Fix type annotations incorrectly highlighted as modules.
Diffstat (limited to 'rust-mode-tests.el')
-rw-r--r--rust-mode-tests.el21
1 files changed, 21 insertions, 0 deletions
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index e7a0429..e41245f 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -1403,6 +1403,27 @@ this_is_not_a_string();)"
"\"/*! doc */\""
'("\"/*! doc */\"" font-lock-string-face)))
+(ert-deftest font-lock-module ()
+ (rust-test-font-lock
+ "foo::bar"
+ '("foo" font-lock-type-face)))
+
+(ert-deftest font-lock-submodule ()
+ (rust-test-font-lock
+ "foo::bar::baz"
+ '("foo" font-lock-type-face
+ "bar" font-lock-type-face)))
+
+(ert-deftest font-lock-type-annotation ()
+ "Ensure type annotations are not confused with modules."
+ (rust-test-font-lock
+ "parse::<i32>();"
+ ;; Only the i32 should have been highlighted.
+ '("i32" font-lock-type-face))
+ (rust-test-font-lock
+ "foo:: <i32>"
+ ;; Only the i32 should have been highlighted.
+ '("i32" font-lock-type-face)))
(ert-deftest indent-method-chains-no-align ()
(let ((rust-indent-method-chain nil)) (test-indent