Skip to content

Commit

Permalink
test: add test case extract_with_specified_path_attr
Browse files Browse the repository at this point in the history
  • Loading branch information
Young-Flash committed May 12, 2024
1 parent 0c13f0c commit 3e57aab
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions crates/ide-assists/src/handlers/move_module_to_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,72 @@ mod tests {

use super::*;

#[test]
fn extract_with_specified_path_attr() {
check_assist(
move_module_to_file,
r#"
//- /main.rs
#[path="parser/__mod.rs"]
mod parser;
//- /parser/__mod.rs
fn test() {}
mod $0expr {
struct A {}
}
"#,
r#"
//- /parser/__mod.rs
fn test() {}
mod expr;
//- /parser/expr.rs
struct A {}
"#,
);

check_assist(
move_module_to_file,
r#"
//- /main.rs
#[path="parser/a/__mod.rs"]
mod parser;
//- /parser/a/__mod.rs
fn test() {}
mod $0expr {
struct A {}
}
"#,
r#"
//- /parser/a/__mod.rs
fn test() {}
mod expr;
//- /parser/a/expr.rs
struct A {}
"#,
);

check_assist(
move_module_to_file,
r#"
//- /main.rs
#[path="a.rs"]
mod parser;
//- /a.rs
fn test() {}
mod $0expr {
struct A {}
}
"#,
r#"
//- /a.rs
fn test() {}
mod expr;
//- /expr.rs
struct A {}
"#,
);
}

#[test]
fn extract_from_root() {
check_assist(
Expand Down

0 comments on commit 3e57aab

Please sign in to comment.