From cafc7e350132f8121c45f863f601eba44392c63a Mon Sep 17 00:00:00 2001 From: longfangsong Date: Sun, 12 Sep 2021 11:20:28 +0800 Subject: [PATCH] Fix doc test --- .../ide_assists/src/handlers/promote_mod_file.rs | 5 +++-- crates/ide_assists/src/tests/generated.rs | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/crates/ide_assists/src/handlers/promote_mod_file.rs b/crates/ide_assists/src/handlers/promote_mod_file.rs index 2ba51d169929..5991c0989fec 100644 --- a/crates/ide_assists/src/handlers/promote_mod_file.rs +++ b/crates/ide_assists/src/handlers/promote_mod_file.rs @@ -14,12 +14,13 @@ use crate::assist_context::{AssistContext, Assists}; // Moves inline module's contents to a separate file. // // ``` -// // a.rs +// //- /main.rs +// mod a; +// //- /a.rs // $0fn t() {} // ``` // -> // ``` -// // /a/mod.rs // fn t() {} // ``` pub(crate) fn promote_mod_file(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { diff --git a/crates/ide_assists/src/tests/generated.rs b/crates/ide_assists/src/tests/generated.rs index 39ab8c7b74e0..98e0bd674890 100644 --- a/crates/ide_assists/src/tests/generated.rs +++ b/crates/ide_assists/src/tests/generated.rs @@ -1226,6 +1226,22 @@ mod foo; ) } +#[test] +fn doctest_promote_mod_file() { + check_doc_test( + "promote_mod_file", + r#####" +//- /main.rs +mod a; +//- /a.rs +$0fn t() {} +"#####, + r#####" +fn t() {} +"#####, + ) +} + #[test] fn doctest_pull_assignment_up() { check_doc_test(