diff options
Diffstat (limited to 'support/texlab/tests/test_diagnostics_build.rs')
-rw-r--r-- | support/texlab/tests/test_diagnostics_build.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/support/texlab/tests/test_diagnostics_build.rs b/support/texlab/tests/test_diagnostics_build.rs new file mode 100644 index 0000000000..9c953bee7a --- /dev/null +++ b/support/texlab/tests/test_diagnostics_build.rs @@ -0,0 +1,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()); + } +} |