summaryrefslogtreecommitdiff
path: root/support/texlab/tests/test_completion_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_completion_latex_label.rs
parent02e4625a78a5029e8b5dc2a4ec70193b232f497e (diff)
CTAN sync 201912030301
Diffstat (limited to 'support/texlab/tests/test_completion_latex_label.rs')
-rw-r--r--support/texlab/tests/test_completion_latex_label.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/support/texlab/tests/test_completion_latex_label.rs b/support/texlab/tests/test_completion_latex_label.rs
new file mode 100644
index 0000000000..78f302672e
--- /dev/null
+++ b/support/texlab/tests/test_completion_latex_label.rs
@@ -0,0 +1,34 @@
+pub mod support;
+
+use lsp_types::Documentation;
+use support::completion::*;
+
+const SCENARIO: &str = "latex/label";
+
+#[tokio::test]
+async fn default() {
+ let (_, items) = run_list(SCENARIO, "bar.tex", 4, 5).await;
+ assert_eq!(items.len(), 6);
+ verify::text_edit(&items[0], 4, 5, 4, 5, "sec:bar");
+ verify::text_edit(&items[1], 4, 5, 4, 5, "sec:foo");
+ verify::text_edit(&items[2], 4, 5, 4, 5, "eq:foo");
+ verify::text_edit(&items[3], 4, 5, 4, 5, "eq:bar");
+ verify::text_edit(&items[4], 4, 5, 4, 5, "fig:baz");
+ verify::text_edit(&items[5], 4, 5, 4, 5, "thm:foo");
+ verify::detail(&items[0], "Section 2 (Bar)");
+ verify::detail(&items[1], "Section 1 (Foo)");
+ verify::detail(&items[2], "Equation (1)");
+ verify::detail(&items[3], "Equation (2)");
+ verify::detail(&items[4], "Figure 1");
+ verify::detail(&items[5], "Lemma 1");
+ assert_eq!(
+ *items[4].documentation.as_ref().unwrap(),
+ Documentation::String("Baz".into())
+ );
+}
+
+#[tokio::test]
+async fn equation() {
+ let (_, items) = run_list(SCENARIO, "bar.tex", 5, 7).await;
+ verify::labels(&items, vec!["eq:bar", "eq:foo"]);
+}