From 8e459125df5eebef6d7b07c5646ba6eefba63d05 Mon Sep 17 00:00:00 2001 From: davidsemakula Date: Tue, 9 Apr 2024 18:08:25 +0300 Subject: [PATCH] internal: add auto-import assist tests for raw identifiers --- .../ide-assists/src/handlers/auto_import.rs | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/crates/ide-assists/src/handlers/auto_import.rs b/crates/ide-assists/src/handlers/auto_import.rs index 5545e41f530..b90bccb48ed 100644 --- a/crates/ide-assists/src/handlers/auto_import.rs +++ b/crates/ide-assists/src/handlers/auto_import.rs @@ -1620,4 +1620,50 @@ pub fn bar() -> IoResult$0<()> {} "#, ); } + + #[test] + fn preserve_raw_identifiers_strict() { + check_assist( + auto_import, + r" + r#as$0 + + pub mod ffi_mod { + pub fn r#as() {}; + } + ", + r" + use ffi_mod::r#as; + + r#as + + pub mod ffi_mod { + pub fn r#as() {}; + } + ", + ); + } + + #[test] + fn preserve_raw_identifiers_reserved() { + check_assist( + auto_import, + r" + r#abstract$0 + + pub mod ffi_mod { + pub fn r#abstract() {}; + } + ", + r" + use ffi_mod::r#abstract; + + r#abstract + + pub mod ffi_mod { + pub fn r#abstract() {}; + } + ", + ); + } }