diff options
Diffstat (limited to 'crates/ide/src/syntax_highlighting/tests.rs')
-rw-r--r-- | crates/ide/src/syntax_highlighting/tests.rs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/crates/ide/src/syntax_highlighting/tests.rs b/crates/ide/src/syntax_highlighting/tests.rs index 9ce26e930..be4447ebb 100644 --- a/crates/ide/src/syntax_highlighting/tests.rs +++ b/crates/ide/src/syntax_highlighting/tests.rs | |||
@@ -10,6 +10,7 @@ use crate::{fixture, FileRange, HlTag, TextRange}; | |||
10 | fn test_highlighting() { | 10 | fn test_highlighting() { |
11 | check_highlighting( | 11 | check_highlighting( |
12 | r#" | 12 | r#" |
13 | //- /main.rs crate:main deps:foo | ||
13 | use inner::{self as inner_mod}; | 14 | use inner::{self as inner_mod}; |
14 | mod inner {} | 15 | mod inner {} |
15 | 16 | ||
@@ -222,6 +223,43 @@ async fn async_main() { | |||
222 | 223 | ||
223 | unsafe trait Dangerous {} | 224 | unsafe trait Dangerous {} |
224 | impl Dangerous for () {} | 225 | impl Dangerous for () {} |
226 | |||
227 | fn use_foo_items() { | ||
228 | let bob = foo::Person { | ||
229 | name: "Bob", | ||
230 | age: foo::consts::NUMBER, | ||
231 | }; | ||
232 | |||
233 | let control_flow = foo::identity(foo::ControlFlow::Continue); | ||
234 | |||
235 | if let foo::ControlFlow::Die = control_flow { | ||
236 | foo::die!(); | ||
237 | } | ||
238 | } | ||
239 | |||
240 | |||
241 | //- /foo.rs crate:foo | ||
242 | pub struct Person { | ||
243 | pub name: &'static str, | ||
244 | pub age: u8, | ||
245 | } | ||
246 | |||
247 | pub enum ControlFlow { | ||
248 | Continue, | ||
249 | Die, | ||
250 | } | ||
251 | |||
252 | pub fn identity<T>(x: T) -> T { x } | ||
253 | |||
254 | pub mod consts { | ||
255 | pub const NUMBER: i64 = 92; | ||
256 | } | ||
257 | |||
258 | macro_rules! die { | ||
259 | () => { | ||
260 | panic!(); | ||
261 | }; | ||
262 | } | ||
225 | "# | 263 | "# |
226 | .trim(), | 264 | .trim(), |
227 | expect_file!["./test_data/highlighting.html"], | 265 | expect_file!["./test_data/highlighting.html"], |