-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a646439
commit 6ee2ebe
Showing
27 changed files
with
2,038 additions
and
38 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/// This mod is mainly to support vscode native test extension | ||
/// please reference: https://code.visualstudio.com/api/extension-guides/testing | ||
// It's a pretty rough implementation for now, reuse a lot of logic from runnable. | ||
use ide_db::{ | ||
base_db::{FileId}, | ||
RootDatabase, | ||
}; | ||
|
||
use crate::{runnables::runnables, Runnable, RunnableKind}; | ||
|
||
pub(crate) fn test_runnables_in_file(db: &RootDatabase, file_id: FileId) -> Vec<Runnable> { | ||
return test_runnables_in_file_iter(db, file_id).collect(); | ||
} | ||
|
||
fn test_runnables_in_file_iter( | ||
db: &RootDatabase, | ||
file_id: FileId, | ||
) -> impl Iterator<Item = Runnable> { | ||
// TODO: Maybe should extract another function with another optional RunnableKind, | ||
// so that we could collect specfic Runnables on the fly, rather than fileter all agagin. | ||
let all_runnables = runnables(db, file_id); | ||
let tests = all_runnables.into_iter().filter(is_test_runnable); | ||
return tests; | ||
|
||
fn is_test_runnable(runnable: &Runnable) -> bool { | ||
match runnable.kind { | ||
RunnableKind::Test { .. } => true, | ||
RunnableKind::TestMod { .. } => true, | ||
_ => false, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.