aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/syntax_highlighting/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src/syntax_highlighting/tests.rs')
-rw-r--r--crates/ide/src/syntax_highlighting/tests.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/crates/ide/src/syntax_highlighting/tests.rs b/crates/ide/src/syntax_highlighting/tests.rs
index 369ae0972..7b3b5caf9 100644
--- a/crates/ide/src/syntax_highlighting/tests.rs
+++ b/crates/ide/src/syntax_highlighting/tests.rs
@@ -659,6 +659,43 @@ fn foo() {
659 ); 659 );
660} 660}
661 661
662#[test]
663fn test_highlight_trait_items() {
664 check_highlighting(
665 r#"
666struct Cat;
667
668trait Animal {
669 const SOUND: &'static str;
670
671 fn make_sound(&self) {
672 println!("{}", Self::SOUND);
673 }
674}
675
676impl Animal for Cat {
677 const SOUND: &'static str = "Meow!";
678}
679
680impl Cat {
681 const SPEED: u32 = 2;
682
683 fn run() {}
684}
685
686fn main() {
687 let cat = Cat;
688 cat.make_sound();
689 let _sound = Cat::SOUND;
690 let _speed = Cat::SPEED;
691 Cat::run();
692}
693"#,
694 expect_file!["./test_data/highlight_trait_items.html"],
695 false,
696 );
697}
698
662/// Highlights the code given by the `ra_fixture` argument, renders the 699/// Highlights the code given by the `ra_fixture` argument, renders the
663/// result as HTML, and compares it with the HTML file given as `snapshot`. 700/// result as HTML, and compares it with the HTML file given as `snapshot`.
664/// Note that the `snapshot` file is overwritten by the rendered HTML. 701/// Note that the `snapshot` file is overwritten by the rendered HTML.