Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/syntax_highlighting/tests.rs')
| -rw-r--r-- | crates/ide/src/syntax_highlighting/tests.rs | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/crates/ide/src/syntax_highlighting/tests.rs b/crates/ide/src/syntax_highlighting/tests.rs index c14e3330e3..0af743431b 100644 --- a/crates/ide/src/syntax_highlighting/tests.rs +++ b/crates/ide/src/syntax_highlighting/tests.rs @@ -113,11 +113,11 @@ struct Foo { x: u32, } -trait Bar where Self: { +trait Bar { fn bar(&self) -> i32; } -impl Bar for Foo where Self: { +impl Bar for Foo { fn bar(&self) -> i32 { self.x } @@ -264,7 +264,7 @@ pub enum Bool { True, False } impl Bool { pub const fn to_primitive(self) -> bool { - matches!(self, Self::True) + true } } const USAGE_OF_BOOL:bool = Bool::True.to_primitive(); @@ -335,6 +335,30 @@ where } #[test] +fn test_keyword_highlighting() { + check_highlighting( + r#" +extern crate self; + +use crate; +use self; +mod __ { + use super::*; +} + +macro_rules! void { + ($($tt:tt)) => {} +} +void!(Self); +struct __ where Self:; +fn __(_: Self) {} +"#, + expect_file!["./test_data/highlight_keywords.html"], + false, + ); +} + +#[test] fn test_string_highlighting() { // The format string detection is based on macro-expansion, // thus, we have to copy the macro definition from `std` |