diff options
Diffstat (limited to 'crates/ide/src/syntax_highlighting/tests.rs')
-rw-r--r-- | crates/ide/src/syntax_highlighting/tests.rs | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/crates/ide/src/syntax_highlighting/tests.rs b/crates/ide/src/syntax_highlighting/tests.rs index 9d0cd1af5..7b2922b0d 100644 --- a/crates/ide/src/syntax_highlighting/tests.rs +++ b/crates/ide/src/syntax_highlighting/tests.rs | |||
@@ -468,7 +468,7 @@ fn main() { | |||
468 | } | 468 | } |
469 | 469 | ||
470 | #[test] | 470 | #[test] |
471 | fn test_highlight_doctest() { | 471 | fn test_highlight_doc_comment() { |
472 | check_highlighting( | 472 | check_highlighting( |
473 | r#" | 473 | r#" |
474 | /// ``` | 474 | /// ``` |
@@ -516,7 +516,7 @@ impl Foo { | |||
516 | /// comment */ | 516 | /// comment */ |
517 | /// | 517 | /// |
518 | /// let multi_line_string = "Foo | 518 | /// let multi_line_string = "Foo |
519 | /// bar | 519 | /// bar\n |
520 | /// "; | 520 | /// "; |
521 | /// | 521 | /// |
522 | /// ``` | 522 | /// ``` |
@@ -533,6 +533,11 @@ impl Foo { | |||
533 | } | 533 | } |
534 | } | 534 | } |
535 | 535 | ||
536 | /// [`Foo`](Foo) is a struct | ||
537 | /// [`all_the_links`](all_the_links) is this function | ||
538 | /// [`noop`](noop) is a macro below | ||
539 | pub fn all_the_links() {} | ||
540 | |||
536 | /// ``` | 541 | /// ``` |
537 | /// noop!(1); | 542 | /// noop!(1); |
538 | /// ``` | 543 | /// ``` |
@@ -541,6 +546,38 @@ macro_rules! noop { | |||
541 | $expr | 546 | $expr |
542 | } | 547 | } |
543 | } | 548 | } |
549 | |||
550 | /// ```rust | ||
551 | /// let _ = example(&[1, 2, 3]); | ||
552 | /// ``` | ||
553 | /// | ||
554 | /// ``` | ||
555 | /// loop {} | ||
556 | #[cfg_attr(not(feature = "false"), doc = "loop {}")] | ||
557 | #[doc = "loop {}"] | ||
558 | /// ``` | ||
559 | /// | ||
560 | #[cfg_attr(feature = "alloc", doc = "```rust")] | ||
561 | #[cfg_attr(not(feature = "alloc"), doc = "```ignore")] | ||
562 | /// let _ = example(&alloc::vec![1, 2, 3]); | ||
563 | /// ``` | ||
564 | pub fn mix_and_match() {} | ||
565 | |||
566 | /** | ||
567 | It is beyond me why you'd use these when you got /// | ||
568 | ```rust | ||
569 | let _ = example(&[1, 2, 3]); | ||
570 | ``` | ||
571 | */ | ||
572 | pub fn block_comments() {} | ||
573 | |||
574 | /** | ||
575 | Really, I don't get it | ||
576 | ```rust | ||
577 | let _ = example(&[1, 2, 3]); | ||
578 | ``` | ||
579 | */ | ||
580 | pub fn block_comments2() {} | ||
544 | "# | 581 | "# |
545 | .trim(), | 582 | .trim(), |
546 | expect_file!["./test_data/highlight_doctest.html"], | 583 | expect_file!["./test_data/highlight_doctest.html"], |