summaryrefslogtreecommitdiff
path: root/rust-mode-tests.el
diff options
context:
space:
mode:
authorAankhen <Aankhen@users.noreply.github.com>2017-07-28 18:02:38 +0530
committerAankhen <Aankhen@users.noreply.github.com>2017-07-28 18:27:42 +0530
commit34cc528f04574068e1d222c8122354fb4a9278ab (patch)
tree4f4f6966a972776ac62f7639c550f37e4d256abf /rust-mode-tests.el
parent0985f5fde747f64b3fcff2661226aa4dad286e04 (diff)
downloadrust-mode-34cc528f04574068e1d222c8122354fb4a9278ab.tar.gz
Highlight question mark operator using new `rust-question-mark-face'.
Diffstat (limited to 'rust-mode-tests.el')
-rw-r--r--rust-mode-tests.el32
1 files changed, 32 insertions, 0 deletions
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index b1d51c9..614340c 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -1510,6 +1510,38 @@ this_is_not_a_string();)"
;; Only the i32 should have been highlighted.
'("i32" font-lock-type-face)))
+(ert-deftest font-lock-question-mark ()
+ "Ensure question mark operator is highlighted."
+ (rust-test-font-lock
+ "?"
+ '("?" rust-question-mark-face))
+ (rust-test-font-lock
+ "foo\(\)?;"
+ '("?" rust-question-mark-face))
+ (rust-test-font-lock
+ "foo\(bar\(\)?\);"
+ '("?" rust-question-mark-face))
+ (rust-test-font-lock
+ "\"?\""
+ '("\"?\"" font-lock-string-face))
+ (rust-test-font-lock
+ "foo\(\"?\"\);"
+ '("\"?\"" font-lock-string-face))
+ (rust-test-font-lock
+ "// ?"
+ '("// " font-lock-comment-delimiter-face
+ "?" font-lock-comment-face))
+ (rust-test-font-lock
+ "/// ?"
+ '("/// ?" font-lock-doc-face))
+ (rust-test-font-lock
+ "foo\(\"?\"\);"
+ '("\"?\"" font-lock-string-face))
+ (rust-test-font-lock
+ "foo\(\"?\"\)?;"
+ '("\"?\"" font-lock-string-face
+ "?" rust-question-mark-face)))
+
(ert-deftest rust-test-default-context-sensitive ()
(rust-test-font-lock
"let default = 7; impl foo { default fn f() { } }"