From 34cc528f04574068e1d222c8122354fb4a9278ab Mon Sep 17 00:00:00 2001 From: Aankhen Date: Fri, 28 Jul 2017 18:02:38 +0530 Subject: Highlight question mark operator using new `rust-question-mark-face'. --- rust-mode-tests.el | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'rust-mode-tests.el') 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() { } }" -- cgit v1.2.3