diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2015-02-08 06:59:00 -0500 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2015-02-08 06:59:00 -0500 |
| commit | 4d633fc20de2560f26bcaca95b5458dfa2efb6eb (patch) | |
| tree | f1dbc4216aa9773790464af56a8bcb3f600703dd /rust-mode-tests.el | |
| parent | 19bc0e9ef1dd72bfde10644037a13719a38777fc (diff) | |
| parent | bddc933d1eb56254c68618abc3e5ca462572beab (diff) | |
| download | rust-mode-4d633fc20de2560f26bcaca95b5458dfa2efb6eb.tar.gz | |
Merge pull request #32 from MicahChalmer/raw-string-handling
Parse and highlight raw strings correctly
Diffstat (limited to 'rust-mode-tests.el')
| -rw-r--r-- | rust-mode-tests.el | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/rust-mode-tests.el b/rust-mode-tests.el index 36e59df..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))) @@ -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 " |
