Fix doc test

This commit is contained in:
longfangsong 2021-09-12 11:20:28 +08:00
parent 3edc25dc26
commit cafc7e3501
2 changed files with 19 additions and 2 deletions

View file

@ -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<()> {

View file

@ -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(