mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Merge #165
165: Make modules with tests runnable r=farodin91 a=farodin91 Fixes #154 I having problems to traverse the path to module. The main problem is that module_tree only supports `FileId` and not `Module` in files. Any idea? I need to clean up the code a bit later. Co-authored-by: Jan Jansen <farodin91@googlemail.com>
This commit is contained in:
commit
2a65020442
8 changed files with 288 additions and 63 deletions
|
@ -256,6 +256,7 @@ pub fn handle_runnables(
|
|||
range: runnable.range.conv_with(&line_index),
|
||||
label: match &runnable.kind {
|
||||
RunnableKind::Test { name } => format!("test {}", name),
|
||||
RunnableKind::TestMod { path } => format!("test-mod {}", path),
|
||||
RunnableKind::Bin => "run binary".to_string(),
|
||||
},
|
||||
bin: "cargo".to_string(),
|
||||
|
@ -307,6 +308,15 @@ pub fn handle_runnables(
|
|||
res.push(name.to_string());
|
||||
res.push("--nocapture".to_string());
|
||||
}
|
||||
RunnableKind::TestMod { path } => {
|
||||
res.push("test".to_string());
|
||||
if let Some(spec) = spec {
|
||||
spec.push_to(&mut res);
|
||||
}
|
||||
res.push("--".to_string());
|
||||
res.push(path.to_string());
|
||||
res.push("--nocapture".to_string());
|
||||
}
|
||||
RunnableKind::Bin => {
|
||||
res.push("run".to_string());
|
||||
if let Some(spec) = spec {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue