mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
Update file structure tests
This commit is contained in:
parent
14bf5bb7ee
commit
53e3a7aeb4
1 changed files with 215 additions and 213 deletions
|
@ -173,12 +173,19 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use expect::{expect, Expect};
|
||||
|
||||
use super::*;
|
||||
use insta::assert_debug_snapshot;
|
||||
|
||||
fn check(ra_fixture: &str, expect: Expect) {
|
||||
let file = SourceFile::parse(ra_fixture).ok().unwrap();
|
||||
let structure = file_structure(&file);
|
||||
expect.assert_debug_eq(&structure)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_file_structure() {
|
||||
let file = SourceFile::parse(
|
||||
check(
|
||||
r#"
|
||||
struct Foo {
|
||||
x: i32
|
||||
|
@ -223,12 +230,7 @@ fn obsolete() {}
|
|||
#[deprecated(note = "for awhile")]
|
||||
fn very_obsolete() {}
|
||||
"#,
|
||||
)
|
||||
.ok()
|
||||
.unwrap();
|
||||
let structure = file_structure(&file);
|
||||
assert_debug_snapshot!(structure,
|
||||
@r###"
|
||||
expect![[r#"
|
||||
[
|
||||
StructureNode {
|
||||
parent: None,
|
||||
|
@ -432,7 +434,7 @@ fn very_obsolete() {}
|
|||
deprecated: true,
|
||||
},
|
||||
]
|
||||
"###
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue