summaryrefslogtreecommitdiff
path: root/support/texlab/tests/test_hover_latex_label.rs
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-12-03 03:01:24 +0000
committerNorbert Preining <norbert@preining.info>2019-12-03 03:01:24 +0000
commitb8d4bb76703bcb15578e2b23c5d256532180b894 (patch)
treebedd1df7a00521a2bd986b3c0289d6556a59e39b /support/texlab/tests/test_hover_latex_label.rs
parent02e4625a78a5029e8b5dc2a4ec70193b232f497e (diff)
CTAN sync 201912030301
Diffstat (limited to 'support/texlab/tests/test_hover_latex_label.rs')
-rw-r--r--support/texlab/tests/test_hover_latex_label.rs59
1 files changed, 59 insertions, 0 deletions
diff --git a/support/texlab/tests/test_hover_latex_label.rs b/support/texlab/tests/test_hover_latex_label.rs
new file mode 100644
index 0000000000..94a96ad533
--- /dev/null
+++ b/support/texlab/tests/test_hover_latex_label.rs
@@ -0,0 +1,59 @@
+pub mod support;
+
+use lsp_types::*;
+use std::sync::Arc;
+use support::capabilities::CLIENT_FULL_CAPABILITIES;
+use support::*;
+use tokio::fs;
+
+const SCENARIO: &str = "hover/latex/label";
+
+#[tokio::test]
+async fn reload_aux() {
+ let scenario = Scenario::new(SCENARIO, Arc::new(Box::new(tex::Unknown)));
+ scenario.initialize(&CLIENT_FULL_CAPABILITIES).await;
+ scenario.open("section.tex").await;
+ let position = Position::new(3, 10);
+ let identifier = TextDocumentIdentifier::new(scenario.uri("section.tex").into());
+ let params = TextDocumentPositionParams::new(identifier, position);
+ let contents = scenario
+ .server
+ .execute_async(|svr| svr.hover(params.clone()))
+ .await
+ .unwrap()
+ .unwrap()
+ .contents;
+
+ assert_eq!(
+ contents,
+ HoverContents::Markup(MarkupContent {
+ kind: MarkupKind::PlainText,
+ value: "Section (Foo)".into()
+ })
+ );
+
+ let aux_path = scenario
+ .uri("section.tex")
+ .to_file_path()
+ .unwrap()
+ .with_extension("aux");
+ fs::write(aux_path, "\\newlabel{sec:foo}{{1}{1}}")
+ .await
+ .unwrap();
+
+ let contents = scenario
+ .server
+ .execute_async(|svr| svr.hover(params))
+ .await
+ .unwrap()
+ .unwrap()
+ .contents;
+
+ assert_eq!(
+ contents,
+ HoverContents::Markup(MarkupContent {
+ kind: MarkupKind::PlainText,
+ value: "Section 1 (Foo)".into()
+ })
+ );
+}