summaryrefslogtreecommitdiff
path: root/support/texlab/tests/test_completion_latex_component.rs
blob: 6671fa9c07ad5b05295f6bb2f2bc61f51ecdac43 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
pub mod support;

use support::completion::*;

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

#[tokio::test]
async fn kernel_command() {
    let item = run_item(SCENARIO, "foo.tex", 0, 1, "documentclass").await;
    verify::text_edit(&item, 0, 1, 0, 14, "documentclass");
    verify::detail(&item, "built-in");
}

#[tokio::test]
async fn kernel_command_glyph() {
    let item = run_item(SCENARIO, "foo.tex", 7, 7, "varepsilon").await;
    verify::text_edit(&item, 7, 1, 7, 7, "varepsilon");
    verify::detail(&item, "ε, built-in");
}

#[tokio::test]
async fn kernel_environment() {
    let item = run_item(SCENARIO, "foo.tex", 6, 10, "document").await;
    verify::text_edit(&item, 6, 7, 6, 10, "document");
    verify::detail(&item, "built-in");
}

#[tokio::test]
async fn class_import() {
    let item = run_item(SCENARIO, "foo.tex", 0, 19, "book").await;
    verify::text_edit(&item, 0, 15, 0, 19, "book");
    assert!(item.documentation.is_some());
}

#[tokio::test]
async fn class_command() {
    let item = run_item(SCENARIO, "foo.tex", 2, 5, "chapter").await;
    verify::text_edit(&item, 2, 1, 2, 5, "chapter");
    verify::detail(&item, "book.cls");
}

#[tokio::test]
async fn class_environment() {
    let item = run_item(SCENARIO, "foo.tex", 4, 13, "theindex").await;
    verify::text_edit(&item, 4, 7, 4, 13, "theindex");
    verify::detail(&item, "book.cls");
}

#[tokio::test]
async fn package_import() {
    let item = run_item(SCENARIO, "foo.tex", 1, 15, "amsmath").await;
    verify::text_edit(&item, 1, 12, 1, 19, "amsmath");
    assert!(item.documentation.is_some());
}

#[tokio::test]
async fn package_command() {
    let item = run_item(SCENARIO, "foo.tex", 3, 7, "varDelta").await;
    verify::text_edit(&item, 3, 1, 3, 7, "varDelta");
    verify::detail(&item, "amsmath.sty");
}

#[tokio::test]
async fn package_environment() {
    let item = run_item(SCENARIO, "foo.tex", 5, 5, "align").await;
    verify::text_edit(&item, 5, 5, 5, 9, "align");
    verify::detail(&item, "amsmath.sty");
}