From a653c6b23138a264c6f263ae5ffc1b09888d3b88 Mon Sep 17 00:00:00 2001 From: Micah Chalmer Date: Sat, 7 Feb 2015 21:21:00 -0500 Subject: Highlight raw strings correctly --- rust-mode-tests.el | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'rust-mode-tests.el') diff --git a/rust-mode-tests.el b/rust-mode-tests.el index 36e59df..7cbfc3d 100644 --- a/rust-mode-tests.el +++ b/rust-mode-tests.el @@ -927,6 +927,42 @@ list of substrings of `STR' each followed by its face." "let" font-lock-keyword-face "'\\''" font-lock-string-face))) +(ert-deftest font-lock-raw-strings-no-hashes () + (rust-test-font-lock + "r\"No hashes\";" + '("r\"No hashes\"" font-lock-string-face))) + +(ert-deftest font-lock-raw-strings-double-quote () + (rust-test-font-lock + "fn main() { + r#\"With a double quote (\")\"#; +} +" + '("fn" font-lock-keyword-face + "main" font-lock-function-name-face + "r#\"With a double quote (\")\"#" font-lock-string-face))) + +(ert-deftest font-lock-raw-strings-two-hashes () + (rust-test-font-lock + "r##\"With two hashes\"##;" + '("r##\"With two hashes\"##" font-lock-string-face))) + +(ert-deftest font-lock-raw-strings-backslash-at-end () + (rust-test-font-lock + "r\"With a backslash at the end\\\";" + '("r\"With a backslash at the end\\\"" font-lock-string-face))) + +(ert-deftest font-lock-two-raw-strings () + (rust-test-font-lock + "fn main() { + r\"With a backslash at the end\\\"; + r##\"With two hashes\"##; +}" + '("fn" font-lock-keyword-face + "main" font-lock-function-name-face + "r\"With a backslash at the end\\\"" font-lock-string-face + "r##\"With two hashes\"##" font-lock-string-face))) + (ert-deftest indent-method-chains-no-align () (let ((rust-indent-method-chain nil)) (test-indent " -- cgit v1.2.3 From bddc933d1eb56254c68618abc3e5ca462572beab Mon Sep 17 00:00:00 2001 From: Micah Chalmer Date: Sat, 7 Feb 2015 21:21:27 -0500 Subject: Fix typo in comment --- rust-mode-tests.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rust-mode-tests.el') diff --git a/rust-mode-tests.el b/rust-mode-tests.el index 7cbfc3d..e20e5fa 100644 --- a/rust-mode-tests.el +++ b/rust-mode-tests.el @@ -290,7 +290,7 @@ very very very long string deindented 1 (lambda () - ;; The indentation will fial in some cases if the syntax properties are + ;; 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 (buffer-size))) -- cgit v1.2.3