summaryrefslogtreecommitdiff
path: root/support/texlab/tests/test_diagnostics_build.rs
blob: 9c953bee7a8320a2483e3fc3b2f29af28c33fb23 (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
pub mod support;

use std::sync::Arc;
use support::*;
use tokio::fs;

#[tokio::test]
async fn did_change_update() {
    let scenario = Scenario::new("diagnostics/build", Arc::new(Box::new(tex::Unknown)));
    scenario.open("foo.tex").await;
    {
        let diagnostics_by_uri = scenario.client.diagnostics_by_uri.lock().await;
        let diagnostics = &diagnostics_by_uri[&scenario.uri("foo.tex")];
        assert_eq!(diagnostics.len(), 1);
        assert_eq!(diagnostics[0].message, "Undefined control sequence.");
    }
    let log_path = scenario.uri("foo.log").to_file_path().unwrap();
    fs::write(log_path, "").await.unwrap();
    scenario.server.execute(|_| ()).await;
    {
        let diagnostics_by_uri = scenario.client.diagnostics_by_uri.lock().await;
        let diagnostics = &diagnostics_by_uri[&scenario.uri("foo.tex")];
        assert!(diagnostics.is_empty());
    }
}