Update file structure tests
This commit is contained in:
parent
14bf5bb7ee
commit
53e3a7aeb4
@ -173,12 +173,19 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use expect::{expect, Expect};
|
||||||
|
|
||||||
use super::*;
|
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]
|
#[test]
|
||||||
fn test_file_structure() {
|
fn test_file_structure() {
|
||||||
let file = SourceFile::parse(
|
check(
|
||||||
r#"
|
r#"
|
||||||
struct Foo {
|
struct Foo {
|
||||||
x: i32
|
x: i32
|
||||||
@ -223,12 +230,7 @@ fn obsolete() {}
|
|||||||
#[deprecated(note = "for awhile")]
|
#[deprecated(note = "for awhile")]
|
||||||
fn very_obsolete() {}
|
fn very_obsolete() {}
|
||||||
"#,
|
"#,
|
||||||
)
|
expect![[r#"
|
||||||
.ok()
|
|
||||||
.unwrap();
|
|
||||||
let structure = file_structure(&file);
|
|
||||||
assert_debug_snapshot!(structure,
|
|
||||||
@r###"
|
|
||||||
[
|
[
|
||||||
StructureNode {
|
StructureNode {
|
||||||
parent: None,
|
parent: None,
|
||||||
@ -432,7 +434,7 @@ fn very_obsolete() {}
|
|||||||
deprecated: true,
|
deprecated: true,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
"###
|
"#]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user