-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: added snapshot test for document symbols
- Loading branch information
1 parent
5de87e5
commit 3a0bdaa
Showing
8 changed files
with
271 additions
and
42 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
mod support; | ||
|
||
#[test] | ||
fn test_document_symbols() { | ||
let mut server = support::Project::with_fixture( | ||
r#" | ||
//- /Mun.toml | ||
[package] | ||
name = "foo" | ||
version = "0.0.0" | ||
//- /src/mod.mun | ||
fn main() -> i32 {} | ||
struct Foo {} | ||
type Bar = Foo; | ||
"#, | ||
) | ||
.server(); | ||
|
||
let response = async_std::task::block_on( | ||
server.send_request::<lsp_types::request::DocumentSymbolRequest>( | ||
lsp_types::DocumentSymbolParams { | ||
text_document: server.doc_id("src/mod.mun"), | ||
work_done_progress_params: Default::default(), | ||
partial_result_params: Default::default(), | ||
}, | ||
), | ||
); | ||
|
||
insta::assert_debug_snapshot!(response); | ||
} |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
mod support; | ||
|
||
#[test] | ||
fn test_server() { | ||
let _server = support::Server::new(); | ||
#[async_std::test] | ||
async fn test_server() { | ||
let _server = support::Project::with_fixture("").server(); | ||
} |
95 changes: 95 additions & 0 deletions
95
crates/mun_language_server/tests/snapshots/document_symbols__document_symbols.snap
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,95 @@ | ||
--- | ||
source: crates/mun_language_server/tests/document_symbols.rs | ||
expression: response | ||
--- | ||
Some( | ||
Nested( | ||
[ | ||
DocumentSymbol { | ||
name: "main", | ||
detail: Some( | ||
"fn() -> i32", | ||
), | ||
kind: Function, | ||
deprecated: None, | ||
range: Range { | ||
start: Position { | ||
line: 0, | ||
character: 0, | ||
}, | ||
end: Position { | ||
line: 0, | ||
character: 19, | ||
}, | ||
}, | ||
selection_range: Range { | ||
start: Position { | ||
line: 0, | ||
character: 3, | ||
}, | ||
end: Position { | ||
line: 0, | ||
character: 7, | ||
}, | ||
}, | ||
children: None, | ||
}, | ||
DocumentSymbol { | ||
name: "Foo", | ||
detail: None, | ||
kind: Struct, | ||
deprecated: None, | ||
range: Range { | ||
start: Position { | ||
line: 2, | ||
character: 0, | ||
}, | ||
end: Position { | ||
line: 2, | ||
character: 13, | ||
}, | ||
}, | ||
selection_range: Range { | ||
start: Position { | ||
line: 2, | ||
character: 7, | ||
}, | ||
end: Position { | ||
line: 2, | ||
character: 10, | ||
}, | ||
}, | ||
children: None, | ||
}, | ||
DocumentSymbol { | ||
name: "Bar", | ||
detail: Some( | ||
"Foo", | ||
), | ||
kind: TypeParameter, | ||
deprecated: None, | ||
range: Range { | ||
start: Position { | ||
line: 4, | ||
character: 0, | ||
}, | ||
end: Position { | ||
line: 4, | ||
character: 15, | ||
}, | ||
}, | ||
selection_range: Range { | ||
start: Position { | ||
line: 4, | ||
character: 5, | ||
}, | ||
end: Position { | ||
line: 4, | ||
character: 8, | ||
}, | ||
}, | ||
children: None, | ||
}, | ||
], | ||
), | ||
) |
Oops, something went wrong.