aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/syntax_highlighting/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/syntax_highlighting/tests.rs')
-rw-r--r--crates/ra_ide/src/syntax_highlighting/tests.rs22
1 files changed, 20 insertions, 2 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting/tests.rs b/crates/ra_ide/src/syntax_highlighting/tests.rs
index 949bf59a0..062b3ff4a 100644
--- a/crates/ra_ide/src/syntax_highlighting/tests.rs
+++ b/crates/ra_ide/src/syntax_highlighting/tests.rs
@@ -43,6 +43,12 @@ def_fn! {
43 } 43 }
44} 44}
45 45
46macro_rules! noop {
47 ($expr:expr) => {
48 $expr
49 }
50}
51
46// comment 52// comment
47fn main() { 53fn main() {
48 println!("Hello, {}!", 92); 54 println!("Hello, {}!", 92);
@@ -61,6 +67,8 @@ fn main() {
61 // Do nothing 67 // Do nothing
62 } 68 }
63 69
70 noop!(noop!(1));
71
64 let mut x = 42; 72 let mut x = 42;
65 let y = &mut x; 73 let y = &mut x;
66 let z = &y; 74 let z = &y;
@@ -279,7 +287,13 @@ fn main() {
279fn test_highlight_doctest() { 287fn test_highlight_doctest() {
280 check_highlighting( 288 check_highlighting(
281 r#" 289 r#"
290struct Foo {
291 bar: bool,
292}
293
282impl Foo { 294impl Foo {
295 pub const bar: bool = true;
296
283 /// Constructs a new `Foo`. 297 /// Constructs a new `Foo`.
284 /// 298 ///
285 /// # Examples 299 /// # Examples
@@ -289,7 +303,7 @@ impl Foo {
289 /// let mut foo: Foo = Foo::new(); 303 /// let mut foo: Foo = Foo::new();
290 /// ``` 304 /// ```
291 pub const fn new() -> Foo { 305 pub const fn new() -> Foo {
292 Foo { } 306 Foo { bar: true }
293 } 307 }
294 308
295 /// `bar` method on `Foo`. 309 /// `bar` method on `Foo`.
@@ -297,11 +311,15 @@ impl Foo {
297 /// # Examples 311 /// # Examples
298 /// 312 ///
299 /// ``` 313 /// ```
314 /// use x::y;
315 ///
300 /// let foo = Foo::new(); 316 /// let foo = Foo::new();
301 /// 317 ///
302 /// // calls bar on foo 318 /// // calls bar on foo
303 /// assert!(foo.bar()); 319 /// assert!(foo.bar());
304 /// 320 ///
321 /// let bar = foo.bar || Foo::bar;
322 ///
305 /// /* multi-line 323 /// /* multi-line
306 /// comment */ 324 /// comment */
307 /// 325 ///
@@ -322,7 +340,7 @@ impl Foo {
322 .trim(), 340 .trim(),
323 "crates/ra_ide/src/snapshots/highlight_doctest.html", 341 "crates/ra_ide/src/snapshots/highlight_doctest.html",
324 false, 342 false,
325 ) 343 );
326} 344}
327 345
328/// Highlights the code given by the `ra_fixture` argument, renders the 346/// Highlights the code given by the `ra_fixture` argument, renders the