summaryrefslogtreecommitdiff
path: root/support/texlab/tests/test_completion_latex_citation.rs
blob: 07ecd6690fdf35a37afc727e9bf94ff2da3de8d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
pub mod support;

use lsp_types::*;
use support::completion::*;

const SCENARIO: &str = "latex/citation";

#[tokio::test]
async fn valid_citation() {
    let item = run_item(SCENARIO, "foo.tex", 5, 6, "foo:2019").await;
    verify::text_edit(&item, 5, 6, 5, 6, "foo:2019");
    assert_eq!(
        item.documentation.unwrap(),
        Documentation::MarkupContent(MarkupContent {
            kind: MarkupKind::Markdown,
            value: "Bar, F. (2019). *Baz Qux*.".into()
        })
    );
}

#[tokio::test]
async fn invalid_citation() {
    let item = run_item(SCENARIO, "foo.tex", 5, 6, "bar:2005").await;
    verify::text_edit(&item, 5, 6, 5, 6, "bar:2005");
    assert_eq!(item.documentation, None);
}