From 3baa526fb07184ce9804a06c8e0251971eea3b49 Mon Sep 17 00:00:00 2001 From: Anatol Liu Date: Wed, 4 Nov 2020 20:08:46 -0800 Subject: Add static semantic token modifier for associated functions with no &self --- crates/ide/src/syntax_highlighting/tests.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'crates/ide/src/syntax_highlighting/tests.rs') diff --git a/crates/ide/src/syntax_highlighting/tests.rs b/crates/ide/src/syntax_highlighting/tests.rs index 2b667b0d4..5c22e2fce 100644 --- a/crates/ide/src/syntax_highlighting/tests.rs +++ b/crates/ide/src/syntax_highlighting/tests.rs @@ -513,6 +513,34 @@ fn test_extern_crate() { ); } +#[test] +fn test_associated_function() { + check_highlighting( + r#" +fn not_static() {} + +struct foo {} + +impl foo { + pub fn is_static() {} + pub fn is_not_static(&self) {} +} + +trait t { + fn t_is_static() {} + fn t_is_not_static(&self) {} +} + +impl t for foo { + pub fn is_static() {} + pub fn is_not_static(&self) {} +} + "#, + expect_file!["./test_data/highlight_assoc_functions.html"], + false, + ) +} + /// Highlights the code given by the `ra_fixture` argument, renders the /// result as HTML, and compares it with the HTML file given as `snapshot`. /// Note that the `snapshot` file is overwritten by the rendered HTML. -- cgit v1.2.3