mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
move tests to where they belong
This commit is contained in:
parent
e9af69d9db
commit
309716cffe
4 changed files with 32 additions and 44 deletions
|
@ -152,6 +152,9 @@ fn check_struct_shorthand_initialization(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use test_utils::assert_eq_text;
|
||||
use insta::assert_debug_snapshot_matches;
|
||||
|
||||
use crate::mock_analysis::single_file;
|
||||
|
||||
use super::*;
|
||||
|
||||
|
@ -180,6 +183,34 @@ mod tests {
|
|||
assert_eq_text!(after, &actual);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_unresolved_module_diagnostic() {
|
||||
let (analysis, file_id) = single_file("mod foo;");
|
||||
let diagnostics = analysis.diagnostics(file_id).unwrap();
|
||||
assert_debug_snapshot_matches!(diagnostics, @r####"[
|
||||
Diagnostic {
|
||||
message: "unresolved module",
|
||||
range: [0; 8),
|
||||
fix: Some(
|
||||
SourceChange {
|
||||
label: "create module",
|
||||
source_file_edits: [],
|
||||
file_system_edits: [
|
||||
CreateFile {
|
||||
source_root: SourceRootId(
|
||||
0
|
||||
),
|
||||
path: "foo.rs"
|
||||
}
|
||||
],
|
||||
cursor_position: None
|
||||
}
|
||||
),
|
||||
severity: Error
|
||||
}
|
||||
]"####);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_check_unnecessary_braces_in_use_statement() {
|
||||
check_not_applicable(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue