diff options
Diffstat (limited to 'support/texlab/tests')
111 files changed, 3728 insertions, 3012 deletions
diff --git a/support/texlab/tests/integration/completion.rs b/support/texlab/tests/integration/completion.rs new file mode 100644 index 0000000000..4b3b4ecd83 --- /dev/null +++ b/support/texlab/tests/integration/completion.rs @@ -0,0 +1,1227 @@ +#[cfg(feature = "citation")] +use texlab::protocol::{MarkupContent, MarkupKind}; + +use indoc::indoc; +use itertools::Itertools; +use texlab::{ + protocol::{CompletionItem, CompletionTextEdit, Documentation, Range, RangeExt, TextEdit}, + test::{TestBed, TestBedBuilder, TestLspClient, PULL_CAPABILITIES}, +}; + +async fn run_item( + test_bed: &TestBed, + relative_path: &str, + line: u64, + character: u64, + label: &str, +) -> CompletionItem { + let item = test_bed + .completion(relative_path, line, character) + .await + .unwrap() + .into_iter() + .find(|item| item.label == label) + .unwrap(); + + test_bed.client.completion_resolve(item).await.unwrap() +} + +async fn run_list( + test_bed: &TestBed, + relative_path: &str, + line: u64, + character: u64, +) -> Vec<String> { + test_bed + .completion(relative_path, line, character) + .await + .unwrap() + .into_iter() + .map(|item| item.label) + .sorted() + .collect() +} + +fn verify_text_edit( + item: &CompletionItem, + start_line: u64, + start_character: u64, + end_line: u64, + end_character: u64, + text: &str, +) { + assert_eq!( + *item.text_edit.as_ref().unwrap(), + CompletionTextEdit::Edit(TextEdit::new( + Range::new_simple(start_line, start_character, end_line, end_character), + text.into() + )) + ); +} + +fn verify_detail(item: &CompletionItem, detail: &str) { + assert_eq!(item.detail.as_ref().unwrap(), detail); +} + +#[tokio::test] +async fn empty_latex_document() { + let mut test_bed = TestBedBuilder::new().file("main.tex", "").build().await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_items = test_bed.completion("main.tex", 0, 0).await.unwrap(); + + test_bed.shutdown().await; + + assert!(actual_items.is_empty()); +} + +#[tokio::test] +async fn empty_bibtex_document() { + let mut test_bed = TestBedBuilder::new().file("main.bib", "").build().await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + + let actual_items = test_bed.completion("main.bib", 0, 0).await.unwrap(); + + test_bed.shutdown().await; + + assert!(actual_items.is_empty()); +} + +#[tokio::test] +async fn bibtex_comment() { + let mut test_bed = TestBedBuilder::new().file("main.bib", "foo").build().await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + + let actual_items = test_bed.completion("main.bib", 0, 2).await.unwrap(); + + test_bed.shutdown().await; + + assert!(actual_items.is_empty()); +} + +#[tokio::test] +async fn bibtex_command_incomplete_entry() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.bib", + indoc!( + r#" + @article{foo, + author = {\LaT + } + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + + let actual_item = run_item(&test_bed, "main.bib", 1, 18, "LaTeX").await; + + test_bed.shutdown().await; + + verify_detail(&actual_item, "built-in"); + verify_text_edit(&actual_item, 1, 15, 1, 18, "LaTeX"); +} + +#[tokio::test] +async fn bibtex_command_complete_entry() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.bib", + indoc!( + r#" + @article{foo, + author = {\LaT} + } + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + + let actual_item = run_item(&test_bed, "main.bib", 1, 18, "LaTeX").await; + + test_bed.shutdown().await; + + verify_detail(&actual_item, "built-in"); + verify_text_edit(&actual_item, 1, 15, 1, 18, "LaTeX"); +} + +#[tokio::test] +async fn bibtex_type_empty() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.bib", + indoc!( + r#" + @ + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + + let actual_item = run_item(&test_bed, "main.bib", 0, 1, "article").await; + + test_bed.shutdown().await; + + assert!(actual_item.documentation.is_some()); + verify_text_edit(&actual_item, 0, 1, 0, 1, "article"); +} + +#[tokio::test] +async fn bibtex_type_incomplete() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.bib", + indoc!( + r#" + @art + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + + let actual_item = run_item(&test_bed, "main.bib", 0, 1, "article").await; + + test_bed.shutdown().await; + + assert!(actual_item.documentation.is_some()); + verify_text_edit(&actual_item, 0, 1, 0, 4, "article"); +} + +#[tokio::test] +async fn bibtex_type_complete() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.bib", + indoc!( + r#" + @article + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + + let actual_item = run_item(&test_bed, "main.bib", 0, 1, "article").await; + + test_bed.shutdown().await; + + assert!(actual_item.documentation.is_some()); + verify_text_edit(&actual_item, 0, 1, 0, 8, "article"); +} + +#[tokio::test] +async fn bibtex_field_incomplete_entry() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.bib", + indoc!( + r#" + @article{foo, + titl + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + + let actual_item = run_item(&test_bed, "main.bib", 1, 6, "title").await; + + test_bed.shutdown().await; + + assert!(actual_item.documentation.is_some()); + verify_text_edit(&actual_item, 1, 4, 1, 8, "title"); +} + +#[tokio::test] +async fn bibtex_field_complete_entry() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.bib", + indoc!( + r#" + @article{foo, + title = {} + } + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + + let actual_item = run_item(&test_bed, "main.bib", 1, 6, "title").await; + + test_bed.shutdown().await; + + assert!(actual_item.documentation.is_some()); + verify_text_edit(&actual_item, 1, 4, 1, 9, "title"); +} + +#[tokio::test] +async fn latex_begin_command() { + let mut test_bed = TestBedBuilder::new().file("main.tex", r#"\"#).build().await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_item = run_item(&test_bed, "main.tex", 0, 1, "begin").await; + + test_bed.shutdown().await; + + verify_detail(&actual_item, "built-in"); +} + +#[cfg(feature = "citation")] +#[tokio::test] +async fn latex_citation_valid() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{article} + \bibliography{main} + \begin{document} + \cite{ + \end{document} + "# + ), + ) + .file( + "main.bib", + indoc!( + r#" + @article{foo:2019, + author = {Foo Bar}, + title = {Baz Qux}, + year = {2019}, + } + + @article{bar:2005,} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + test_bed.open("main.bib").await; + + let actual_item = run_item(&test_bed, "main.tex", 3, 6, "foo:2019").await; + + test_bed.shutdown().await; + + verify_text_edit(&actual_item, 3, 6, 3, 6, "foo:2019"); + assert_eq!( + actual_item.documentation.unwrap(), + Documentation::MarkupContent(MarkupContent { + kind: MarkupKind::Markdown, + value: "Bar, F. (2019). *Baz Qux*.".into() + }) + ); +} + +#[cfg(feature = "citation")] +#[tokio::test] +async fn latex_citation_invalid() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{article} + \bibliography{main} + \begin{document} + \cite{ + \end{document} + "# + ), + ) + .file( + "main.bib", + indoc!( + r#" + @article{foo:2019, + author = {Foo Bar}, + title = {Baz Qux}, + year = {2019}, + } + + @article{bar:2005,} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + test_bed.open("main.bib").await; + + let actual_item = run_item(&test_bed, "main.tex", 3, 6, "bar:2005").await; + + test_bed.shutdown().await; + + verify_text_edit(&actual_item, 3, 6, 3, 6, "bar:2005"); + assert_eq!(actual_item.documentation, None); +} + +#[tokio::test] +async fn latex_color_name() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \color{re} + \definecolor{foo}{ + \definecolorset{R} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_item = run_item(&test_bed, "main.tex", 0, 9, "red").await; + + test_bed.shutdown().await; + + verify_text_edit(&actual_item, 0, 7, 0, 9, "red"); +} + +#[tokio::test] +async fn latex_color_model_define_color() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \color{re} + \definecolor{foo}{ + \definecolorset{R} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_item = run_item(&test_bed, "main.tex", 1, 18, "rgb").await; + + test_bed.shutdown().await; + + verify_text_edit(&actual_item, 1, 18, 1, 18, "rgb"); +} + +#[tokio::test] +async fn latex_model_define_color_set() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \color{re} + \definecolor{foo}{ + \definecolorset{R} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_item = run_item(&test_bed, "main.tex", 2, 17, "RGB").await; + + test_bed.shutdown().await; + + verify_text_edit(&actual_item, 2, 16, 2, 17, "RGB"); +} + +#[tokio::test] +async fn latex_component_kernel_command() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{book} + \usepackage{amsmath} + \chap + \varDel + \begin{theind} + \end{alig} + \begin{doc} + \vareps + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_item = run_item(&test_bed, "main.tex", 0, 1, "documentclass").await; + + test_bed.shutdown().await; + + verify_detail(&actual_item, "built-in"); + verify_text_edit(&actual_item, 0, 1, 0, 14, "documentclass"); +} + +#[tokio::test] +async fn latex_component_kernel_command_glyph() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{book} + \usepackage{amsmath} + \chap + \varDel + \begin{theind} + \end{alig} + \begin{doc} + \vareps + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_item = run_item(&test_bed, "main.tex", 7, 7, "varepsilon").await; + + test_bed.shutdown().await; + + verify_detail(&actual_item, "ε, built-in"); + verify_text_edit(&actual_item, 7, 1, 7, 7, "varepsilon"); +} + +#[tokio::test] +async fn latex_component_kernel_environment() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{book} + \usepackage{amsmath} + \chap + \varDel + \begin{theind} + \end{alig} + \begin{doc} + \vareps + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_item = run_item(&test_bed, "main.tex", 6, 10, "document").await; + + test_bed.shutdown().await; + + verify_detail(&actual_item, "built-in"); + verify_text_edit(&actual_item, 6, 7, 6, 10, "document"); +} + +#[tokio::test] +async fn latex_component_class_command() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{book} + \usepackage{amsmath} + \chap + \varDel + \begin{theind} + \end{alig} + \begin{doc} + \vareps + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_item = run_item(&test_bed, "main.tex", 2, 5, "chapter").await; + + test_bed.shutdown().await; + + verify_detail(&actual_item, "book.cls"); + verify_text_edit(&actual_item, 2, 1, 2, 5, "chapter"); +} + +#[tokio::test] +async fn latex_component_class_environment() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{book} + \usepackage{amsmath} + \chap + \varDel + \begin{theind} + \end{alig} + \begin{doc} + \vareps + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_item = run_item(&test_bed, "main.tex", 4, 13, "theindex").await; + + test_bed.shutdown().await; + + verify_detail(&actual_item, "book.cls"); + verify_text_edit(&actual_item, 4, 7, 4, 13, "theindex"); +} + +#[tokio::test] +async fn latex_component_package_command() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{book} + \usepackage{amsmath} + \chap + \varDel + \begin{theind} + \end{alig} + \begin{doc} + \vareps + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_item = run_item(&test_bed, "main.tex", 3, 7, "varDelta").await; + + test_bed.shutdown().await; + + verify_detail(&actual_item, "amsmath.sty"); + verify_text_edit(&actual_item, 3, 1, 3, 7, "varDelta"); +} + +#[tokio::test] +async fn latex_component_package_environment() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{book} + \usepackage{amsmath} + \chap + \varDel + \begin{theind} + \end{alig} + \begin{doc} + \vareps + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_item = run_item(&test_bed, "main.tex", 5, 5, "align").await; + + test_bed.shutdown().await; + + verify_detail(&actual_item, "amsmath.sty"); + verify_text_edit(&actual_item, 5, 5, 5, 9, "align"); +} + +#[tokio::test] +async fn latex_import_class() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{book} + \usepackage{amsmath} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_item = run_item(&test_bed, "main.tex", 0, 19, "book").await; + + test_bed.shutdown().await; + + assert!(actual_item.documentation.is_some()); + verify_text_edit(&actual_item, 0, 15, 0, 19, "book"); +} + +#[tokio::test] +async fn latex_import_package() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{book} + \usepackage{amsmath} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_item = run_item(&test_bed, "main.tex", 1, 15, "amsmath").await; + + test_bed.shutdown().await; + + assert!(actual_item.documentation.is_some()); + verify_text_edit(&actual_item, 1, 12, 1, 19, "amsmath"); +} + +#[tokio::test] +async fn latex_include_relative_root_no_extension() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{article} + \include{} + \input{} + \input{qux/} + \addbibresource{} + "# + ), + ) + .file("foo.bib", "") + .file("bar.tex", "") + .file("qux/baz.tex", "") + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_items = run_list(&test_bed, "main.tex", 1, 9).await; + + test_bed.shutdown().await; + + assert_eq!(actual_items, vec!["bar", "main", "qux"]); +} + +#[tokio::test] +async fn latex_include_relative_root_with_extension() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{article} + \include{} + \input{} + \input{qux/} + \addbibresource{} + "# + ), + ) + .file("foo.bib", "") + .file("bar.tex", "") + .file("qux/baz.tex", "") + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_items = run_list(&test_bed, "main.tex", 2, 7).await; + + test_bed.shutdown().await; + + assert_eq!(actual_items, vec!["bar.tex", "main.tex", "qux"]); +} + +#[tokio::test] +async fn latex_include_relative_subdir() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{article} + \include{} + \input{} + \input{qux/} + \addbibresource{} + "# + ), + ) + .file("foo.bib", "") + .file("bar.tex", "") + .file("qux/baz.tex", "") + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_items = run_list(&test_bed, "main.tex", 3, 11).await; + + test_bed.shutdown().await; + + assert_eq!(actual_items, vec!["baz.tex"]); +} + +#[tokio::test] +async fn latex_include_relative_parent_dir() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{article} + \include{} + \input{} + \input{qux/} + \addbibresource{} + "# + ), + ) + .file("foo.bib", "") + .file("bar.tex", "") + .file("qux/baz.tex", r#"\input{../}"#) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("qux/baz.tex").await; + + let actual_items = run_list(&test_bed, "qux/baz.tex", 0, 10).await; + + test_bed.shutdown().await; + + assert_eq!(actual_items, vec!["bar.tex", "main.tex", "qux"]); +} + +#[tokio::test] +async fn latex_include_relative_bibliography() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{article} + \include{} + \input{} + \input{qux/} + \addbibresource{} + "# + ), + ) + .file("foo.bib", "") + .file("bar.tex", "") + .file("qux/baz.tex", "") + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_items = run_list(&test_bed, "main.tex", 4, 16).await; + + test_bed.shutdown().await; + + assert_eq!(actual_items, vec!["foo.bib", "qux"]); +} + +#[tokio::test] +async fn latex_include_root_dir() { + let mut test_bed = TestBedBuilder::new() + .file("src/main.tex", r#"\input{}"#) + .root_dir(".") + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("src/main.tex").await; + + let actual_items = run_list(&test_bed, "src/main.tex", 0, 7).await; + + test_bed.shutdown().await; + + assert_eq!(actual_items, vec!["src"]); +} + +#[tokio::test] +async fn latex_label() { + let mut test_bed = TestBedBuilder::new() + .file( + "foo.tex", + indoc!( + r#" + \documentclass{article} + % + \usepackage{amsmath} + \usepackage{caption} + \usepackage{amsthm} + \newtheorem{lemma}{Lemma} + % + \begin{document} + % + \section{Foo}% + \label{sec:foo} + % + \begin{equation}% + \label{eq:foo} + 1 + 1 = 2 + \end{equation} + % + \begin{equation}% + \label{eq:bar} + 1 + 1 = 2 + \end{equation} + % + \begin{figure}% + \LaTeX{} + \caption{Baz}% + \label{fig:baz} + \end{figure} + % + \begin{lemma}% + \label{thm:foo} + 1 + 1 = 2 + \end{lemma} + % + \include{bar} + % + \end{document} + "# + ), + ) + .file( + "foo.aux", + indoc!( + r#" + \relax + \@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Baz\relax }}{1}\protected@file@percent } + \providecommand*\caption@xref[2]{\@setref\relax\@undefined{#1}} + \newlabel{fig:baz}{{1}{1}} + \@writefile{toc}{\contentsline {section}{\numberline {1}Foo}{1}\protected@file@percent } + \newlabel{sec:foo}{{1}{1}} + \newlabel{eq:foo}{{1}{1}} + \newlabel{eq:bar}{{2}{1}} + \newlabel{thm:foo}{{1}{1}} + \@input{bar.aux} + "# + ), + ) + .file( + "bar.tex", + indoc!( + r#" + \section{Bar}% + \label{sec:bar} + % + Lorem ipsum dolor sit amet. + \ref{} + \eqref{} + "# + ), + ) + .file( + "bar.aux", + indoc!( + r#" + \relax + \@writefile{toc}{\contentsline {section}{\numberline {2}Bar}{2}\protected@file@percent } + \newlabel{sec:bar}{{2}{2}} + \@setckpt{bar}{ + \setcounter{page}{3} + \setcounter{equation}{2} + \setcounter{enumi}{0} + \setcounter{enumii}{0} + \setcounter{enumiii}{0} + \setcounter{enumiv}{0} + \setcounter{footnote}{0} + \setcounter{mpfootnote}{0} + \setcounter{part}{0} + \setcounter{section}{2} + \setcounter{subsection}{0} + \setcounter{subsubsection}{0} + \setcounter{paragraph}{0} + \setcounter{subparagraph}{0} + \setcounter{figure}{1} + \setcounter{table}{0} + \setcounter{parentequation}{0} + \setcounter{caption@flags}{0} + \setcounter{ContinuedFloat}{0} + \setcounter{lemma}{1} + } + "#), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("foo.tex").await; + test_bed.open("foo.aux").await; + test_bed.open("bar.tex").await; + test_bed.open("bar.aux").await; + + let actual_items = test_bed.completion("bar.tex", 4, 5).await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_items.len(), 6); + verify_text_edit(&actual_items[0], 4, 5, 4, 5, "sec:bar"); + verify_text_edit(&actual_items[1], 4, 5, 4, 5, "sec:foo"); + verify_text_edit(&actual_items[2], 4, 5, 4, 5, "eq:foo"); + verify_text_edit(&actual_items[3], 4, 5, 4, 5, "eq:bar"); + verify_text_edit(&actual_items[4], 4, 5, 4, 5, "fig:baz"); + verify_text_edit(&actual_items[5], 4, 5, 4, 5, "thm:foo"); + verify_detail(&actual_items[0], "Section 2 (Bar)"); + verify_detail(&actual_items[1], "Section 1 (Foo)"); + verify_detail(&actual_items[2], "Equation (1)"); + verify_detail(&actual_items[3], "Equation (2)"); + verify_detail(&actual_items[4], "Figure 1"); + verify_detail(&actual_items[5], "Lemma 1"); + assert_eq!( + *actual_items[4].documentation.as_ref().unwrap(), + Documentation::String("Baz".into()) + ); +} + +#[tokio::test] +async fn latex_preselect_environment() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \begin{document} + \end{ + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_item = run_item(&test_bed, "main.tex", 1, 5, "document").await; + + test_bed.shutdown().await; + + assert!(actual_item.preselect.unwrap()); +} + +#[tokio::test] +async fn latex_theorem() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{article} + \usepackage{amsthm} + \newtheorem{foo}{Foo} + \begin{f} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_item = run_item(&test_bed, "main.tex", 3, 7, "foo").await; + + test_bed.shutdown().await; + + verify_text_edit(&actual_item, 3, 7, 3, 8, "foo"); + verify_detail(&actual_item, "user-defined"); +} + +#[tokio::test] +async fn latex_pgf_library() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \usepackage{tikz} + \usepgflibrary{} + \usetikzlibrary{} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_item = run_item(&test_bed, "main.tex", 1, 15, "arrows").await; + + test_bed.shutdown().await; + + verify_text_edit(&actual_item, 1, 15, 1, 15, "arrows"); +} + +#[tokio::test] +async fn latex_tikz_library() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \usepackage{tikz} + \usepgflibrary{} + \usetikzlibrary{} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_item = run_item(&test_bed, "main.tex", 2, 16, "arrows").await; + + test_bed.shutdown().await; + + verify_text_edit(&actual_item, 2, 16, 2, 16, "arrows"); +} + +#[tokio::test] +async fn latex_user_command() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \foo + \fo + \begin{foo} + \end{foo} + \begin{fo} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_item = run_item(&test_bed, "main.tex", 1, 3, "foo").await; + + test_bed.shutdown().await; + + verify_detail(&actual_item, "user-defined"); + verify_text_edit(&actual_item, 1, 1, 1, 3, "foo"); +} + +#[tokio::test] +async fn latex_user_environment() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \foo + \fo + \begin{foo} + \end{foo} + \begin{fo} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_item = run_item(&test_bed, "main.tex", 4, 7, "foo").await; + + test_bed.shutdown().await; + + verify_detail(&actual_item, "user-defined"); + verify_text_edit(&actual_item, 4, 7, 4, 9, "foo"); +} diff --git a/support/texlab/tests/integration/definition.rs b/support/texlab/tests/integration/definition.rs new file mode 100644 index 0000000000..685b121377 --- /dev/null +++ b/support/texlab/tests/integration/definition.rs @@ -0,0 +1,482 @@ +use indoc::indoc; +use texlab::{ + protocol::{LocationLink, Range, RangeExt}, + test::{TestBedBuilder, LOCATION_LINK_CAPABILITIES, PULL_CAPABILITIES}, +}; + +fn verify_origin_selection_range( + link: &LocationLink, + start_line: u64, + start_character: u64, + end_line: u64, + end_character: u64, +) { + assert_eq!( + link.origin_selection_range, + Some(Range::new_simple( + start_line, + start_character, + end_line, + end_character + )) + ); +} + +#[tokio::test] +async fn empty_latex_document() { + let mut test_bed = TestBedBuilder::new().file("main.tex", "").build().await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_locations = test_bed + .definition_location("main.tex", 0, 0) + .await + .unwrap(); + + test_bed.shutdown().await; + + assert!(actual_locations.is_empty()); +} + +#[tokio::test] +async fn empty_bibtex_document() { + let mut test_bed = TestBedBuilder::new().file("main.bib", "").build().await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + + let actual_locations = test_bed + .definition_location("main.bib", 0, 0) + .await + .unwrap(); + + test_bed.shutdown().await; + + assert!(actual_locations.is_empty()); +} + +#[tokio::test] +async fn bibtex_string() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.bib", + indoc!( + r#" + @string{foo = "Foo"} + % + @string{bar = "Bar"} + % + @article{baz, + author = bar + } + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed + .initialize(LOCATION_LINK_CAPABILITIES.clone()) + .await; + test_bed.open("main.bib").await; + + let mut actual_links = test_bed.definition_link("main.bib", 5, 14).await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_links.len(), 1); + let link = actual_links.pop().unwrap(); + verify_origin_selection_range(&link, 5, 13, 5, 16); + assert_eq!(link.target_uri, test_bed.uri("main.bib").into()); + assert_eq!(link.target_range, Range::new_simple(2, 0, 2, 20)); + assert_eq!(link.target_selection_range, Range::new_simple(2, 8, 2, 11)); +} + +#[tokio::test] +async fn latex_citation_link() { + let mut test_bed = TestBedBuilder::new() + .file( + "foo.tex", + indoc!( + r#" + \bibliography{bar} + \cite{bar} + "# + ), + ) + .file( + "bar.bib", + indoc!( + r#" + @article{foo,} + % + @article{bar,} + "# + ), + ) + .file( + "baz.bib", + indoc!( + r#" + @article{foo,} + % + @article{bar,} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed + .initialize(LOCATION_LINK_CAPABILITIES.clone()) + .await; + test_bed.open("foo.tex").await; + test_bed.open("bar.bib").await; + test_bed.open("baz.bib").await; + + let mut actual_links = test_bed.definition_link("foo.tex", 1, 7).await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_links.len(), 1); + let link = actual_links.pop().unwrap(); + verify_origin_selection_range(&link, 1, 6, 1, 9); + assert_eq!(link.target_uri, test_bed.uri("bar.bib").into()); + assert_eq!(link.target_range, Range::new_simple(2, 0, 2, 14)); + assert_eq!(link.target_selection_range, Range::new_simple(2, 9, 2, 12)); +} + +#[tokio::test] +async fn latex_citation_location() { + let mut test_bed = TestBedBuilder::new() + .file( + "foo.tex", + indoc!( + r#" + \bibliography{bar} + \cite{bar} + "# + ), + ) + .file( + "bar.bib", + indoc!( + r#" + @article{foo,} + % + @article{bar,} + "# + ), + ) + .file( + "baz.bib", + indoc!( + r#" + @article{foo,} + % + @article{bar,} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("foo.tex").await; + test_bed.open("bar.bib").await; + test_bed.open("baz.bib").await; + + let mut actual_locations = test_bed.definition_location("foo.tex", 1, 7).await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_locations.len(), 1); + let location = actual_locations.pop().unwrap(); + assert_eq!(location.uri, test_bed.uri("bar.bib").into()); + assert_eq!(location.range, Range::new_simple(2, 9, 2, 12)); +} + +#[tokio::test] +async fn latex_command_link() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \newcommand{\foo}{Foo} + % + \foo + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed + .initialize(LOCATION_LINK_CAPABILITIES.clone()) + .await; + test_bed.open("main.tex").await; + + let mut actual_links = test_bed.definition_link("main.tex", 2, 2).await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_links.len(), 1); + let link = actual_links.pop().unwrap(); + verify_origin_selection_range(&link, 2, 0, 2, 4); + assert_eq!(link.target_uri, test_bed.uri("main.tex").into()); + assert_eq!(link.target_range, Range::new_simple(0, 0, 0, 22)); + assert_eq!(link.target_selection_range, Range::new_simple(0, 0, 0, 22)); +} + +#[tokio::test] +async fn latex_math_operator_link() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \DeclareMathOperator{\foo}{foo} + % + \foo + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed + .initialize(LOCATION_LINK_CAPABILITIES.clone()) + .await; + test_bed.open("main.tex").await; + + let mut actual_links = test_bed.definition_link("main.tex", 2, 2).await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_links.len(), 1); + let link = actual_links.pop().unwrap(); + verify_origin_selection_range(&link, 2, 0, 2, 4); + assert_eq!(link.target_uri, test_bed.uri("main.tex").into()); + assert_eq!(link.target_range, Range::new_simple(0, 0, 0, 31)); + assert_eq!(link.target_selection_range, Range::new_simple(0, 0, 0, 31)); +} + +#[tokio::test] +async fn latex_label_unknown_link() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \label{foo} + \ref{foo} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed + .initialize(LOCATION_LINK_CAPABILITIES.clone()) + .await; + test_bed.open("main.tex").await; + + let mut actual_links = test_bed.definition_link("main.tex", 1, 7).await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_links.len(), 1); + let link = actual_links.pop().unwrap(); + verify_origin_selection_range(&link, 1, 5, 1, 8); + assert_eq!(link.target_uri, test_bed.uri("main.tex").into()); + assert_eq!(link.target_range, Range::new_simple(0, 0, 0, 11)); + assert_eq!(link.target_selection_range, Range::new_simple(0, 0, 0, 11)); +} + +#[tokio::test] +async fn latex_label_equation_link() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \begin{equation}% + \label{eq:foo} + Foo + \end{equation} + % + \ref{eq:foo} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed + .initialize(LOCATION_LINK_CAPABILITIES.clone()) + .await; + test_bed.open("main.tex").await; + + let mut actual_links = test_bed.definition_link("main.tex", 5, 8).await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_links.len(), 1); + let link = actual_links.pop().unwrap(); + verify_origin_selection_range(&link, 5, 5, 5, 11); + assert_eq!(link.target_uri, test_bed.uri("main.tex").into()); + assert_eq!(link.target_range, Range::new_simple(0, 0, 3, 14)); + assert_eq!(link.target_selection_range, Range::new_simple(1, 0, 1, 14)); +} + +#[tokio::test] +async fn latex_label_float_link() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \begin{figure} + Foo + \caption{Bar} + \label{fig} + \end{figure} + % + \ref{fig} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed + .initialize(LOCATION_LINK_CAPABILITIES.clone()) + .await; + test_bed.open("main.tex").await; + + let mut actual_links = test_bed.definition_link("main.tex", 6, 6).await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_links.len(), 1); + let link = actual_links.pop().unwrap(); + verify_origin_selection_range(&link, 6, 5, 6, 8); + assert_eq!(link.target_uri, test_bed.uri("main.tex").into()); + assert_eq!(link.target_range, Range::new_simple(0, 0, 4, 12)); + assert_eq!(link.target_selection_range, Range::new_simple(3, 0, 3, 11)); +} + +#[tokio::test] +async fn latex_label_item_link() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \begin{enumerate} + \item Foo + \item\label{bar} Bar + \item Baz + \end{enumerate} + % + \ref{bar} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed + .initialize(LOCATION_LINK_CAPABILITIES.clone()) + .await; + test_bed.open("main.tex").await; + + let mut actual_links = test_bed.definition_link("main.tex", 6, 6).await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_links.len(), 1); + let link = actual_links.pop().unwrap(); + verify_origin_selection_range(&link, 6, 5, 6, 8); + assert_eq!(link.target_uri, test_bed.uri("main.tex").into()); + assert_eq!(link.target_range, Range::new_simple(0, 0, 4, 15)); + assert_eq!(link.target_selection_range, Range::new_simple(2, 9, 2, 20)); +} + +#[tokio::test] +async fn latex_label_section_link() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \section{Foo} + \label{sec:foo} + % + \section{Bar} + \label{sec:bar} + % + \ref{sec:foo} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed + .initialize(LOCATION_LINK_CAPABILITIES.clone()) + .await; + test_bed.open("main.tex").await; + + let mut actual_links = test_bed.definition_link("main.tex", 6, 6).await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_links.len(), 1); + let link = actual_links.pop().unwrap(); + verify_origin_selection_range(&link, 6, 5, 6, 12); + assert_eq!(link.target_uri, test_bed.uri("main.tex").into()); + assert_eq!(link.target_range, Range::new_simple(0, 0, 3, 0)); + assert_eq!(link.target_selection_range, Range::new_simple(1, 0, 1, 15)); +} + +#[tokio::test] +async fn latex_label_theorem_link() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \usepackage{amsthm} + \newtheorem{lemma}{Lemma} + % + \begin{lemma}% + \label{thm:foo} + Foo + \end{lemma} + % + \ref{thm:foo} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed + .initialize(LOCATION_LINK_CAPABILITIES.clone()) + .await; + test_bed.open("main.tex").await; + + let mut actual_links = test_bed.definition_link("main.tex", 8, 7).await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_links.len(), 1); + let link = actual_links.pop().unwrap(); + verify_origin_selection_range(&link, 8, 5, 8, 12); + assert_eq!(link.target_uri, test_bed.uri("main.tex").into()); + assert_eq!(link.target_range, Range::new_simple(3, 0, 6, 11)); + assert_eq!(link.target_selection_range, Range::new_simple(4, 0, 4, 15)); +} diff --git a/support/texlab/tests/integration/document_symbol.rs b/support/texlab/tests/integration/document_symbol.rs new file mode 100644 index 0000000000..afc3d54831 --- /dev/null +++ b/support/texlab/tests/integration/document_symbol.rs @@ -0,0 +1,424 @@ +use indoc::indoc; +use texlab::{ + protocol::{DocumentSymbol, Range, RangeExt}, + test::{TestBedBuilder, NESTED_SYMBOL_CAPABILITIES}, +}; + +fn verify_symbol( + symbol: &DocumentSymbol, + name: &str, + detail: Option<&str>, + selection_range: Range, + range: Range, +) { + assert_eq!(symbol.name, name); + assert_eq!(symbol.detail.as_ref().map(AsRef::as_ref), detail); + assert_eq!(symbol.selection_range, selection_range); + assert_eq!(symbol.range, range); +} + +#[tokio::test] +async fn enumerate() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{article} + % + \begin{document} + % + \begin{enumerate} + \item\label{it:foo} Foo + \item\label{it:bar} Bar + \item[Baz] Baz + \item[Qux]\label{it:qux} Qux + \end{enumerate} + % + \end{document} + "# + ), + ) + .file( + "main.aux", + indoc!( + r#" + \relax + \newlabel{it:foo}{{1}{1}} + \newlabel{it:qux}{{2}{1}} + "# + ), + ) + .build() + .await; + + test_bed.spawn(); + test_bed + .initialize(NESTED_SYMBOL_CAPABILITIES.clone()) + .await; + test_bed.open("main.tex").await; + test_bed.open("main.aux").await; + + let mut actual_symbols = test_bed.document_symbol_nested("main.tex").await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_symbols.len(), 1); + verify_symbol( + &actual_symbols[0], + "Enumerate", + None, + Range::new_simple(4, 0, 9, 15), + Range::new_simple(4, 0, 9, 15), + ); + + let children = actual_symbols[0].children.take().unwrap(); + assert_eq!(children.len(), 4); + verify_symbol( + &children[0], + "1", + Some("it:foo"), + Range::new_simple(5, 9, 5, 23), + Range::new_simple(5, 4, 6, 4), + ); + verify_symbol( + &children[1], + "Item", + Some("it:bar"), + Range::new_simple(6, 9, 6, 23), + Range::new_simple(6, 4, 7, 4), + ); + verify_symbol( + &children[2], + "Baz", + None, + Range::new_simple(7, 4, 7, 14), + Range::new_simple(7, 4, 8, 4), + ); + verify_symbol( + &children[3], + "Qux", + Some("it:qux"), + Range::new_simple(8, 14, 8, 28), + Range::new_simple(8, 4, 9, 0), + ); +} + +#[tokio::test] +async fn equation() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{article} + % + \begin{document} + % + \begin{equation}\label{eq:foo} + Foo + \end{equation} + % + \begin{equation}\label{eq:bar} + Bar + \end{equation} + % + \begin{equation} + Baz + \end{equation} + % + \end{document} + "# + ), + ) + .file( + "main.aux", + indoc!( + r#" + \relax + \newlabel{eq:foo}{{1}{1}} + "# + ), + ) + .build() + .await; + + test_bed.spawn(); + test_bed + .initialize(NESTED_SYMBOL_CAPABILITIES.clone()) + .await; + test_bed.open("main.tex").await; + test_bed.open("main.aux").await; + + let actual_symbols = test_bed.document_symbol_nested("main.tex").await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_symbols.len(), 3); + verify_symbol( + &actual_symbols[0], + "Equation (1)", + Some("eq:foo"), + Range::new_simple(4, 16, 4, 30), + Range::new_simple(4, 0, 6, 14), + ); + verify_symbol( + &actual_symbols[1], + "Equation", + Some("eq:bar"), + Range::new_simple(8, 16, 8, 30), + Range::new_simple(8, 0, 10, 14), + ); + verify_symbol( + &actual_symbols[2], + "Equation", + None, + Range::new_simple(12, 0, 14, 14), + Range::new_simple(12, 0, 14, 14), + ); +} + +#[tokio::test] +async fn float() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{article} + % + \begin{document} + % + \begin{figure} + Foo + \caption{Foo}\label{fig:foo} + \end{figure} + % + \begin{figure} + Bar + \caption{Bar}\label{fig:bar} + \end{figure} + % + \begin{figure} + Baz + \caption{Baz} + \end{figure} + % + \begin{figure} + Qux + \end{figure} + % + \end{document} + "# + ), + ) + .file( + "main.aux", + indoc!( + r#" + \relax + \@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Foo}}{1}\protected@file@percent } + \newlabel{fig:foo}{{1}{1}} + \@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces Bar}}{1}\protected@file@percent } + \@writefile{lof}{\contentsline {figure}{\numberline {3}{\ignorespaces Baz}}{1}\protected@file@percent } + "# + ), + ) + .build() + .await; + + test_bed.spawn(); + test_bed + .initialize(NESTED_SYMBOL_CAPABILITIES.clone()) + .await; + test_bed.open("main.tex").await; + test_bed.open("main.aux").await; + + let actual_symbols = test_bed.document_symbol_nested("main.tex").await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_symbols.len(), 3); + verify_symbol( + &actual_symbols[0], + "Figure 1: Foo", + Some("fig:foo"), + Range::new_simple(6, 17, 6, 32), + Range::new_simple(4, 0, 7, 12), + ); + verify_symbol( + &actual_symbols[1], + "Figure: Bar", + Some("fig:bar"), + Range::new_simple(11, 17, 11, 32), + Range::new_simple(9, 0, 12, 12), + ); + verify_symbol( + &actual_symbols[2], + "Figure: Baz", + None, + Range::new_simple(14, 0, 17, 12), + Range::new_simple(14, 0, 17, 12), + ); +} + +#[tokio::test] +async fn section() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{article} + % + \begin{document} + % + \section{Foo} + % + \section{Bar}\label{sec:bar} + % + \subsection{Baz}\label{sec:baz} + % + \end{document} + "# + ), + ) + .file( + "main.aux", + indoc!( + r#" + \relax + \@writefile{toc}{\contentsline {section}{\numberline {1}Foo}{1}\protected@file@percent } + \@writefile{toc}{\contentsline {section}{\numberline {2}Bar}{1}\protected@file@percent } + \newlabel{sec:bar}{{2}{1}} + "# + ), + ) + .build() + .await; + + test_bed.spawn(); + test_bed + .initialize(NESTED_SYMBOL_CAPABILITIES.clone()) + .await; + test_bed.open("main.tex").await; + test_bed.open("main.aux").await; + + let mut actual_symbols = test_bed.document_symbol_nested("main.tex").await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_symbols.len(), 2); + verify_symbol( + &actual_symbols[0], + "Foo", + None, + Range::new_simple(4, 0, 4, 13), + Range::new_simple(4, 0, 6, 0), + ); + verify_symbol( + &actual_symbols[1], + "2 Bar", + Some("sec:bar"), + Range::new_simple(6, 0, 6, 13), + Range::new_simple(6, 0, 10, 0), + ); + + let children = actual_symbols[1].children.take().unwrap(); + assert_eq!(children.len(), 1); + verify_symbol( + &children[0], + "Baz", + Some("sec:baz"), + Range::new_simple(8, 0, 8, 16), + Range::new_simple(8, 0, 10, 0), + ); +} + +#[tokio::test] +async fn theorem() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{article} + \usepackage{amsthm} + \newtheorem{lemma}{Lemma} + % + \begin{document} + % + \begin{lemma}[Foo]\label{thm:foo} + Foo + \end{lemma} + % + \begin{lemma}\label{thm:bar} + Bar + \end{lemma} + % + \begin{lemma}\label{thm:baz} + Baz + \end{lemma} + % + \begin{lemma}[Qux] + Qux + \end{lemma} + % + \end{document} + "# + ), + ) + .file( + "main.aux", + indoc!( + r#" + \relax + \newlabel{thm:foo}{{1}{1}} + \newlabel{thm:bar}{{2}{1}} + "# + ), + ) + .build() + .await; + + test_bed.spawn(); + test_bed + .initialize(NESTED_SYMBOL_CAPABILITIES.clone()) + .await; + test_bed.open("main.tex").await; + test_bed.open("main.aux").await; + + let actual_symbols = test_bed.document_symbol_nested("main.tex").await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_symbols.len(), 4); + verify_symbol( + &actual_symbols[0], + "Lemma 1 (Foo)", + Some("thm:foo"), + Range::new_simple(6, 18, 6, 33), + Range::new_simple(6, 0, 8, 11), + ); + verify_symbol( + &actual_symbols[1], + "Lemma 2", + Some("thm:bar"), + Range::new_simple(10, 13, 10, 28), + Range::new_simple(10, 0, 12, 11), + ); + verify_symbol( + &actual_symbols[2], + "Lemma", + Some("thm:baz"), + Range::new_simple(14, 13, 14, 28), + Range::new_simple(14, 0, 16, 11), + ); + verify_symbol( + &actual_symbols[3], + "Lemma (Qux)", + None, + Range::new_simple(18, 0, 20, 11), + Range::new_simple(18, 0, 20, 11), + ); +} diff --git a/support/texlab/tests/integration/folding.rs b/support/texlab/tests/integration/folding.rs new file mode 100644 index 0000000000..3540e2c680 --- /dev/null +++ b/support/texlab/tests/integration/folding.rs @@ -0,0 +1,126 @@ +use indoc::indoc; +use texlab::{ + protocol::{FoldingRange, FoldingRangeKind}, + test::{TestBedBuilder, PULL_CAPABILITIES}, +}; + +#[tokio::test] +async fn empty_latex_document() { + let mut test_bed = TestBedBuilder::new().file("main.tex", "").build().await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_foldings = test_bed.folding_range("main.tex").await.unwrap(); + + test_bed.shutdown().await; + + assert!(actual_foldings.is_empty()); +} + +#[tokio::test] +async fn empty_bibtex_document() { + let mut test_bed = TestBedBuilder::new().file("main.bib", "").build().await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + + let actual_foldings = test_bed.folding_range("main.bib").await.unwrap(); + + test_bed.shutdown().await; + + assert!(actual_foldings.is_empty()); +} + +#[tokio::test] +async fn latex_sections_with_env() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \begin{document} + \section{Foo} + Foo + \section{Bar} + Bar + \end{document} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_foldings = test_bed.folding_range("main.tex").await.unwrap(); + + test_bed.shutdown().await; + + let expected_foldings = vec![ + FoldingRange { + start_line: 0, + start_character: Some(16), + end_line: 5, + end_character: Some(0), + kind: Some(FoldingRangeKind::Region), + }, + FoldingRange { + start_line: 1, + start_character: Some(13), + end_line: 2, + end_character: Some(0), + kind: Some(FoldingRangeKind::Region), + }, + ]; + assert_eq!(actual_foldings, expected_foldings); +} + +#[tokio::test] +async fn bibtex_entry() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.bib", + indoc!( + r#" + @article{foo, + author = {Foo Bar}, + title = {Baz Qux}, + } + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + + let actual_foldings = test_bed.folding_range("main.bib").await.unwrap(); + + test_bed.shutdown().await; + + let expected_foldings = vec![FoldingRange { + start_line: 0, + start_character: Some(0), + end_line: 3, + end_character: Some(1), + kind: Some(FoldingRangeKind::Region), + }]; + assert_eq!(actual_foldings, expected_foldings); +} + +#[tokio::test] +async fn unknown_file() { + let mut test_bed = TestBedBuilder::new().build().await; + + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + + let actual_foldings = test_bed.folding_range("main.tex").await; + + test_bed.shutdown().await; + + assert_eq!(actual_foldings, None); +} diff --git a/support/texlab/tests/integration/highlight.rs b/support/texlab/tests/integration/highlight.rs new file mode 100644 index 0000000000..ba77a7b8e3 --- /dev/null +++ b/support/texlab/tests/integration/highlight.rs @@ -0,0 +1,83 @@ +use indoc::indoc; +use texlab::{ + protocol::{DocumentHighlight, DocumentHighlightKind, Range, RangeExt}, + test::{TestBedBuilder, PULL_CAPABILITIES}, +}; + +#[tokio::test] +async fn empty_latex_document() { + let mut test_bed = TestBedBuilder::new().file("main.tex", "").build().await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_highlights = test_bed.document_highlight("main.tex", 0, 0).await.unwrap(); + + test_bed.shutdown().await; + + assert!(actual_highlights.is_empty()); +} + +#[tokio::test] +async fn empty_bibtex_document() { + let mut test_bed = TestBedBuilder::new().file("main.bib", "").build().await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + + let actual_highlights = test_bed.document_highlight("main.bib", 0, 0).await.unwrap(); + + test_bed.shutdown().await; + + assert!(actual_highlights.is_empty()); +} + +#[tokio::test] +async fn label() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \label{foo} + \ref{foo} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_highlights = test_bed.document_highlight("main.tex", 0, 7).await.unwrap(); + + let expected_highlights = vec![ + DocumentHighlight { + range: Range::new_simple(0, 7, 0, 10), + kind: Some(DocumentHighlightKind::Write), + }, + DocumentHighlight { + range: Range::new_simple(1, 5, 1, 8), + kind: Some(DocumentHighlightKind::Read), + }, + ]; + + test_bed.shutdown().await; + + assert_eq!(actual_highlights, expected_highlights); +} + +#[tokio::test] +async fn unknown_file() { + let mut test_bed = TestBedBuilder::new().build().await; + + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + + let actual_highlights = test_bed.document_highlight("main.tex", 0, 0).await; + + test_bed.shutdown().await; + + assert_eq!(actual_highlights, None); +} diff --git a/support/texlab/tests/integration/hover.rs b/support/texlab/tests/integration/hover.rs new file mode 100644 index 0000000000..319ebcc5e9 --- /dev/null +++ b/support/texlab/tests/integration/hover.rs @@ -0,0 +1,86 @@ +use indoc::indoc; +use texlab::{ + protocol::{HoverContents, MarkupContent, MarkupKind}, + test::{TestBedBuilder, PULL_CAPABILITIES}, +}; + +#[tokio::test] +async fn label_theorem_child_file() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{article} + \newtheorem{lemma}{Lemma} + \include{child} + \ref{thm:foo} + "# + ), + ) + .file( + "child.tex", + indoc!( + r#" + \begin{lemma}\label{thm:foo} + 1 + 1 = 2 + \end{lemma} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_hover = test_bed.hover("main.tex", 3, 8).await.unwrap().unwrap(); + assert_eq!( + actual_hover.contents, + HoverContents::Markup(MarkupContent { + kind: MarkupKind::PlainText, + value: "Lemma".into() + }) + ); +} + +#[tokio::test] +async fn label_theorem_child_file_number() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{article} + \newtheorem{lemma}{Lemma} + \include{child} + \ref{thm:foo} + "# + ), + ) + .file( + "child.tex", + indoc!( + r#" + \begin{lemma}[Foo]\label{thm:foo} + 1 + 1 = 2 + \end{lemma} + "# + ), + ) + .file("child.aux", r#"\newlabel{thm:foo}{{1}{1}{Foo}{lemma.1}{}}"#) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_hover = test_bed.hover("main.tex", 3, 8).await.unwrap().unwrap(); + assert_eq!( + actual_hover.contents, + HoverContents::Markup(MarkupContent { + kind: MarkupKind::PlainText, + value: "Lemma 1 (Foo)".into() + }) + ); +} diff --git a/support/texlab/tests/integration/issues.rs b/support/texlab/tests/integration/issues.rs new file mode 100644 index 0000000000..59a1bfeacb --- /dev/null +++ b/support/texlab/tests/integration/issues.rs @@ -0,0 +1,350 @@ +use indoc::indoc; +use texlab::{ + protocol::{HoverContents, Location, LocationLink, MarkupContent, MarkupKind, Range, RangeExt}, + test::{TestBedBuilder, LOCATION_LINK_CAPABILITIES, PULL_CAPABILITIES}, +}; + +#[tokio::test] +async fn issue_14() { + let mut test_bed = TestBedBuilder::new() + .file("main.tex", r#"\(\be\)"#) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_items = test_bed.completion("main.tex", 0, 5).await.unwrap(); + + test_bed.shutdown().await; + assert!(actual_items.iter().any(|item| item.label == "beta")); +} + +#[tokio::test] +async fn issue_15_link() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{article} + \begin{document} + \newcommand{\test}{test} + hello \test{} + \end{document} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed + .initialize(LOCATION_LINK_CAPABILITIES.clone()) + .await; + test_bed.open("main.tex").await; + + let actual_links = test_bed.definition_link("main.tex", 3, 9).await.unwrap(); + + test_bed.shutdown().await; + let expected_links = vec![LocationLink { + origin_selection_range: Some(Range::new_simple(3, 6, 3, 13)), + target_range: Range::new_simple(2, 0, 2, 24), + target_selection_range: Range::new_simple(2, 0, 2, 24), + target_uri: test_bed.uri("main.tex").into(), + }]; + assert_eq!(actual_links, expected_links); +} + +#[tokio::test] +async fn issue_15_location() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{article} + \begin{document} + \newcommand{\test}{test} + hello \test{} + \end{document} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_locations = test_bed + .definition_location("main.tex", 3, 9) + .await + .unwrap(); + + test_bed.shutdown().await; + let expected_locations = vec![Location { + range: Range::new_simple(2, 0, 2, 24), + uri: test_bed.uri("main.tex").into(), + }]; + assert_eq!(actual_locations, expected_locations); +} + +#[tokio::test] +async fn issue_17() { + let mut test_bed = TestBedBuilder::new() + .file("main.bib", r#"@ARTICLE{foo,}"#) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + + let actual_hover = test_bed.hover("main.bib", 0, 3).await.unwrap().unwrap(); + + test_bed.shutdown().await; + assert_eq!(actual_hover.range.unwrap(), Range::new_simple(0, 0, 0, 8)); +} + +#[tokio::test] +async fn issue_21() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \label{foo} + \cref{} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_items = test_bed.completion("main.tex", 1, 6).await.unwrap(); + + test_bed.shutdown().await; + assert!(actual_items.iter().any(|item| item.label == "foo")); +} + +#[tokio::test] +async fn issue_22_include() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \bibliography{bibfile} + \cite{} + "# + ), + ) + .file("bibfile.bib", r#"@article{foo,}"#) + .build() + .await; + + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_items = test_bed.completion("main.tex", 1, 6).await.unwrap(); + + test_bed.shutdown().await; + assert!(actual_items.iter().any(|item| item.label == "foo")); +} + +#[tokio::test] +async fn issue_22_definition() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \bibliography{bibfile} + \cite{A,B} + "# + ), + ) + .file( + "bibfile.bib", + indoc!( + r#" + @article{A,} + @article{B,} + "# + ), + ) + .build() + .await; + + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_locations = test_bed + .definition_location("main.tex", 1, 8) + .await + .unwrap(); + + test_bed.shutdown().await; + let expected_locations = vec![Location { + range: Range::new_simple(1, 9, 1, 10), + uri: test_bed.uri("bibfile.bib").into(), + }]; + assert_eq!(actual_locations, expected_locations); +} + +#[tokio::test] +async fn issue_23_completion() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{article} + \begin{document} + \include{test1} + \include{test2} + \end{document} + "# + ), + ) + .file("test1.tex", r#"\section{Section 1}\label{sec:1}"#) + .file( + "test2.tex", + indoc!( + r#" + \section{Section 2}\label{sec:2} + % + This section continues from Section \ref{sec}"# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("test2.tex").await; + test_bed.detect_root("test2.tex").await; + + let actual_items = test_bed.completion("test2.tex", 2, 42).await.unwrap(); + + test_bed.shutdown().await; + assert_eq!(actual_items.len(), 2); +} + +#[tokio::test] +async fn issue_23_rename() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{article} + \begin{document} + \include{test1} + \include{test2} + \end{document} + "# + ), + ) + .file("test1.tex", r#"\section{Section 1}\label{sec:1}"#) + .file( + "test2.tex", + indoc!( + r#" + \section{Section 2}\label{sec:2} + % + This section continues from Section \ref{sec:1}"# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("test1.tex").await; + test_bed.detect_root("test1.tex").await; + + let workspace_edit = test_bed + .rename("test1.tex", 0, 27, "foo") + .await + .unwrap() + .unwrap(); + + test_bed.shutdown().await; + let changes = workspace_edit.changes.unwrap(); + assert!(changes.contains_key(&test_bed.uri("test1.tex"))); + assert!(changes.contains_key(&test_bed.uri("test2.tex"))); +} + +#[tokio::test] +async fn issue_23_hover() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \documentclass{article} + \begin{document} + \include{test1} + \include{test2} + \end{document} + "# + ), + ) + .file("test1.tex", r#"\section{Section 1}\label{sec:1}"#) + .file( + "test2.tex", + indoc!( + r#" + \section{Section 2}\label{sec:2} + % + This section continues from Section \ref{sec:1}"# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("test2.tex").await; + test_bed.detect_root("test2.tex").await; + + let actual_hover = test_bed.hover("test2.tex", 2, 42).await.unwrap().unwrap(); + + test_bed.shutdown().await; + assert_eq!( + actual_hover.contents, + HoverContents::Markup(MarkupContent { + kind: MarkupKind::PlainText, + value: "Section (Section 1)".into() + }) + ); +} + +#[tokio::test] +async fn issue_26() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \section{Foo}\label{sec:foo} + \begin{equation}\label{eq:bar} + \end{equation} + \eqref{} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_items = test_bed.completion("main.tex", 3, 7).await.unwrap(); + + test_bed.shutdown().await; + assert!(actual_items.iter().any(|item| item.label == "eq:bar")); + assert!(actual_items.iter().all(|item| item.label != "sec:foo")); +} diff --git a/support/texlab/tests/integration/link.rs b/support/texlab/tests/integration/link.rs new file mode 100644 index 0000000000..8db718bd26 --- /dev/null +++ b/support/texlab/tests/integration/link.rs @@ -0,0 +1,173 @@ +use indoc::indoc; +use texlab::{ + protocol::{DocumentLink, Range, RangeExt}, + test::{TestBedBuilder, PULL_CAPABILITIES, PUSH_CAPABILITIES}, +}; + +#[tokio::test] +async fn empty_latex_document() { + let mut test_bed = TestBedBuilder::new().file("main.tex", "").build().await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_links = test_bed.document_link("main.tex").await.unwrap(); + + test_bed.shutdown().await; + + assert!(actual_links.is_empty()); +} + +#[tokio::test] +async fn default_settings() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \include{foo/bar} + \input{qux.tex} + "# + ), + ) + .file("foo/bar.tex", "") + .file("qux.tex", "") + .build() + .await; + + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_links = test_bed.document_link("main.tex").await.unwrap(); + + test_bed.shutdown().await; + + let expected_links = vec![ + DocumentLink { + range: Range::new_simple(0, 9, 0, 16), + target: test_bed.uri("foo/bar.tex").into(), + tooltip: None, + }, + DocumentLink { + range: Range::new_simple(1, 7, 1, 14), + target: test_bed.uri("qux.tex").into(), + tooltip: None, + }, + ]; + assert_eq!(actual_links, expected_links); +} + +#[tokio::test] +async fn root_directory() { + let mut test_bed = TestBedBuilder::new() + .file("src/main.tex", r#"\include{src/foo}"#) + .file("src/foo.tex", "") + .root_dir(".") + .build() + .await; + + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("src/main.tex").await; + + let actual_links = test_bed.document_link("src/main.tex").await.unwrap(); + + test_bed.shutdown().await; + + let expected_links = vec![DocumentLink { + range: Range::new_simple(0, 9, 0, 16), + target: test_bed.uri("src/foo.tex").into(), + tooltip: None, + }]; + assert_eq!(actual_links, expected_links); +} + +#[tokio::test] +async fn parent_directory() { + let mut test_bed = TestBedBuilder::new() + .file("src/main.tex", r#"\addbibresource{../foo.bib}"#) + .file("foo.bib", "") + .build() + .await; + + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("src/main.tex").await; + + let actual_links = test_bed.document_link("src/main.tex").await.unwrap(); + + test_bed.shutdown().await; + + let expected_links = vec![DocumentLink { + range: Range::new_simple(0, 16, 0, 26), + target: test_bed.uri("foo.bib").into(), + tooltip: None, + }]; + assert_eq!(actual_links, expected_links); +} + +#[tokio::test] +async fn unknown_file() { + let mut test_bed = TestBedBuilder::new().build().await; + + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + + let actual_links = test_bed.document_link("main.tex").await; + + test_bed.shutdown().await; + + assert_eq!(actual_links, None); +} + +#[tokio::test] +async fn edit_file() { + let mut test_bed = TestBedBuilder::new() + .file("main.tex", "") + .file("foo.tex", "") + .build() + .await; + + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + test_bed.edit("main.tex", r#"\include{foo}"#).await; + + let actual_links = test_bed.document_link("main.tex").await.unwrap(); + + test_bed.shutdown().await; + + let expected_links = vec![DocumentLink { + range: Range::new_simple(0, 9, 0, 12), + target: test_bed.uri("foo.tex").into(), + tooltip: None, + }]; + assert_eq!(actual_links, expected_links); +} + +#[tokio::test] +async fn did_change_configuration() { + let mut test_bed = TestBedBuilder::new() + .file("src/main.tex", r#"\include{src/foo}"#) + .file("src/foo.tex", "") + .root_dir(".") + .build() + .await; + + test_bed.spawn(); + test_bed.initialize(PUSH_CAPABILITIES.clone()).await; + test_bed.open("src/main.tex").await; + test_bed.push_options().await; + + let actual_links = test_bed.document_link("src/main.tex").await.unwrap(); + + test_bed.shutdown().await; + + let expected_links = vec![DocumentLink { + range: Range::new_simple(0, 9, 0, 16), + target: test_bed.uri("src/foo.tex").into(), + tooltip: None, + }]; + assert_eq!(actual_links, expected_links); +} diff --git a/support/texlab/tests/integration/main.rs b/support/texlab/tests/integration/main.rs new file mode 100644 index 0000000000..99c0b23a5c --- /dev/null +++ b/support/texlab/tests/integration/main.rs @@ -0,0 +1,12 @@ +mod completion; +mod definition; +mod document_symbol; +mod folding; +mod highlight; +mod hover; +mod issues; +mod link; +mod prepare_rename; +mod reference; +mod rename; +mod workspace_symbol; diff --git a/support/texlab/tests/integration/prepare_rename.rs b/support/texlab/tests/integration/prepare_rename.rs new file mode 100644 index 0000000000..0efaa712b2 --- /dev/null +++ b/support/texlab/tests/integration/prepare_rename.rs @@ -0,0 +1,151 @@ +use texlab::{ + protocol::{Range, RangeExt}, + test::{TestBedBuilder, PULL_CAPABILITIES}, +}; + +#[tokio::test] +async fn empty_latex_document() { + let mut test_bed = TestBedBuilder::new().file("main.tex", "").build().await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_range = test_bed.prepare_rename("main.tex", 0, 0).await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_range, None); +} + +#[tokio::test] +async fn empty_bibtex_document() { + let mut test_bed = TestBedBuilder::new().file("main.bib", "").build().await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + + let actual_range = test_bed.prepare_rename("main.bib", 0, 0).await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_range, None); +} + +#[tokio::test] +async fn bibtex_entry() { + let mut test_bed = TestBedBuilder::new() + .file("main.bib", r#"@article{foo,}"#) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + + let actual_range = test_bed + .prepare_rename("main.bib", 0, 10) + .await + .unwrap() + .unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_range, Range::new_simple(0, 9, 0, 12)); +} + +#[tokio::test] +async fn latex_citation() { + let mut test_bed = TestBedBuilder::new() + .file("main.tex", r#"\cite{foo,bar}"#) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_range = test_bed + .prepare_rename("main.tex", 0, 11) + .await + .unwrap() + .unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_range, Range::new_simple(0, 10, 0, 13)); +} + +#[tokio::test] +async fn latex_command() { + let mut test_bed = TestBedBuilder::new() + .file("main.tex", r#"\foo"#) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_range = test_bed + .prepare_rename("main.tex", 0, 1) + .await + .unwrap() + .unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_range, Range::new_simple(0, 0, 0, 4)); +} + +#[tokio::test] +async fn latex_environment() { + let mut test_bed = TestBedBuilder::new() + .file("main.tex", r#"\begin{foo}\end{bar}"#) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_range = test_bed + .prepare_rename("main.tex", 0, 7) + .await + .unwrap() + .unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_range, Range::new_simple(0, 7, 0, 10)); +} + +#[tokio::test] +async fn latex_label() { + let mut test_bed = TestBedBuilder::new() + .file("main.tex", r#"\ref{foo,bar}"#) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_range = test_bed + .prepare_rename("main.tex", 0, 9) + .await + .unwrap() + .unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_range, Range::new_simple(0, 9, 0, 12)); +} + +#[tokio::test] +async fn unknown_file() { + let mut test_bed = TestBedBuilder::new().build().await; + + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + + let actual_range = test_bed.prepare_rename("main.tex", 0, 0).await; + + test_bed.shutdown().await; + + assert_eq!(actual_range, None); +} diff --git a/support/texlab/tests/integration/reference.rs b/support/texlab/tests/integration/reference.rs new file mode 100644 index 0000000000..224f85fbfc --- /dev/null +++ b/support/texlab/tests/integration/reference.rs @@ -0,0 +1,150 @@ +use indoc::indoc; +use texlab::{ + protocol::{Location, Range, RangeExt}, + test::{TestBedBuilder, PULL_CAPABILITIES}, +}; + +#[tokio::test] +async fn empty_latex_document() { + let mut test_bed = TestBedBuilder::new().file("main.tex", "").build().await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_refs = test_bed.references("main.tex", 0, 0, false).await.unwrap(); + + test_bed.shutdown().await; + + assert!(actual_refs.is_empty()); +} + +#[tokio::test] +async fn empty_bibtex_document() { + let mut test_bed = TestBedBuilder::new().file("main.bib", "").build().await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + + let actual_refs = test_bed.references("main.bib", 0, 0, false).await.unwrap(); + + test_bed.shutdown().await; + + assert!(actual_refs.is_empty()); +} + +#[tokio::test] +async fn bibtex_entry() { + let mut test_bed = TestBedBuilder::new() + .file("main.bib", r#"@article{foo,}"#) + .file( + "main.tex", + indoc!( + r#" + \addbibresource{main.bib} + \cite{foo} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + test_bed.open("main.tex").await; + + let actual_refs = test_bed.references("main.tex", 1, 8, true).await.unwrap(); + + test_bed.shutdown().await; + + let expected_refs = vec![ + Location { + uri: test_bed.uri("main.tex").into(), + range: Range::new_simple(1, 6, 1, 9), + }, + Location { + uri: test_bed.uri("main.bib").into(), + range: Range::new_simple(0, 9, 0, 12), + }, + ]; + + assert_eq!(actual_refs, expected_refs); +} + +#[tokio::test] +async fn bibtex_string() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.bib", + indoc!( + r#" + @string{foo = "foo"} + @article{bar, author = foo # foo} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + + let actual_refs = test_bed.references("main.bib", 1, 31, false).await.unwrap(); + + test_bed.shutdown().await; + + let expected_refs = vec![ + Location { + uri: test_bed.uri("main.bib").into(), + range: Range::new_simple(1, 23, 1, 26), + }, + Location { + uri: test_bed.uri("main.bib").into(), + range: Range::new_simple(1, 29, 1, 32), + }, + ]; + + assert_eq!(actual_refs, expected_refs); +} + +#[tokio::test] +async fn latex_label() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \label{foo} + \ref{foo} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_refs = test_bed.references("main.tex", 0, 7, false).await.unwrap(); + + test_bed.shutdown().await; + + let expected_refs = vec![Location { + uri: test_bed.uri("main.tex").into(), + range: Range::new_simple(1, 5, 1, 8), + }]; + + assert_eq!(actual_refs, expected_refs); +} + +#[tokio::test] +async fn unknown_file() { + let mut test_bed = TestBedBuilder::new().build().await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + + let actual_refs = test_bed.references("main.tex", 0, 0, false).await; + + test_bed.shutdown().await; + + assert_eq!(actual_refs, None); +} diff --git a/support/texlab/tests/integration/rename.rs b/support/texlab/tests/integration/rename.rs new file mode 100644 index 0000000000..d8522f1ec6 --- /dev/null +++ b/support/texlab/tests/integration/rename.rs @@ -0,0 +1,236 @@ +use indoc::indoc; +use std::collections::HashMap; +use texlab::{ + protocol::{Range, RangeExt, TextEdit, WorkspaceEdit}, + test::{TestBedBuilder, PULL_CAPABILITIES}, +}; + +#[tokio::test] +async fn empty_latex_document() { + let mut test_bed = TestBedBuilder::new().file("main.tex", "").build().await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_edit = test_bed.rename("main.tex", 0, 0, "").await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_edit, None); +} + +#[tokio::test] +async fn empty_bibtex_document() { + let mut test_bed = TestBedBuilder::new().file("main.bib", "").build().await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + + let actual_edit = test_bed.rename("main.bib", 0, 0, "").await.unwrap(); + + test_bed.shutdown().await; + + assert_eq!(actual_edit, None); +} + +#[tokio::test] +async fn bibtex_entry() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.bib", + indoc!( + r#" + @article{foo,} + @article{bar,} + "# + ), + ) + .file( + "main.tex", + indoc!( + r#" + \addbibresource{main.bib} + \cite{foo,bar} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.bib").await; + test_bed.open("main.tex").await; + + let actual_edit = test_bed + .rename("main.bib", 1, 10, "baz") + .await + .unwrap() + .unwrap(); + + test_bed.shutdown().await; + + let mut expected_changes = HashMap::new(); + expected_changes.insert( + test_bed.uri("main.bib").into(), + vec![TextEdit::new(Range::new_simple(1, 9, 1, 12), "baz".into())], + ); + expected_changes.insert( + test_bed.uri("main.tex").into(), + vec![TextEdit::new(Range::new_simple(1, 10, 1, 13), "baz".into())], + ); + + assert_eq!(actual_edit, WorkspaceEdit::new(expected_changes)); +} + +#[tokio::test] +async fn latex_command() { + let mut test_bed = TestBedBuilder::new() + .file( + "foo.tex", + indoc!( + r#" + \input{bar.tex} + \foo + "# + ), + ) + .file( + "bar.tex", + indoc!( + r#" + \foo + \bar + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("foo.tex").await; + test_bed.open("bar.tex").await; + + let actual_edit = test_bed + .rename("foo.tex", 1, 2, "baz") + .await + .unwrap() + .unwrap(); + + test_bed.shutdown().await; + + let mut expected_changes = HashMap::new(); + expected_changes.insert( + test_bed.uri("foo.tex").into(), + vec![TextEdit::new(Range::new_simple(1, 0, 1, 4), "\\baz".into())], + ); + expected_changes.insert( + test_bed.uri("bar.tex").into(), + vec![TextEdit::new(Range::new_simple(0, 0, 0, 4), "\\baz".into())], + ); + + assert_eq!(actual_edit, WorkspaceEdit::new(expected_changes)); +} + +#[tokio::test] +async fn latex_environment() { + let mut test_bed = TestBedBuilder::new() + .file( + "main.tex", + indoc!( + r#" + \begin{foo} + \begin{bar} + Baz + \end{bar} + \end{foo} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("main.tex").await; + + let actual_edit = test_bed + .rename("main.tex", 3, 11, "baz") + .await + .unwrap() + .unwrap(); + + test_bed.shutdown().await; + + let mut expected_changes = HashMap::new(); + expected_changes.insert( + test_bed.uri("main.tex").into(), + vec![ + TextEdit::new(Range::new_simple(1, 11, 1, 14), "baz".into()), + TextEdit::new(Range::new_simple(3, 9, 3, 12), "baz".into()), + ], + ); + + assert_eq!(actual_edit, WorkspaceEdit::new(expected_changes)); +} + +#[tokio::test] +async fn latex_label() { + let mut test_bed = TestBedBuilder::new() + .file( + "foo.tex", + indoc!( + r#" + \input{bar.tex} + \ref{foo,bar} + "# + ), + ) + .file( + "bar.tex", + indoc!( + r#" + \label{foo} + \label{bar} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("foo.tex").await; + test_bed.open("bar.tex").await; + + let actual_edit = test_bed + .rename("foo.tex", 1, 10, "baz") + .await + .unwrap() + .unwrap(); + + test_bed.shutdown().await; + + let mut expected_changes = HashMap::new(); + expected_changes.insert( + test_bed.uri("foo.tex").into(), + vec![TextEdit::new(Range::new_simple(1, 9, 1, 12), "baz".into())], + ); + expected_changes.insert( + test_bed.uri("bar.tex").into(), + vec![TextEdit::new(Range::new_simple(1, 7, 1, 10), "baz".into())], + ); + + assert_eq!(actual_edit, WorkspaceEdit::new(expected_changes)); +} + +#[tokio::test] +async fn unknown_file() { + let mut test_bed = TestBedBuilder::new().build().await; + + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + + let actual_edit = test_bed.rename("main.tex", 0, 0, "").await; + + test_bed.shutdown().await; + + assert_eq!(actual_edit, None); +} diff --git a/support/texlab/tests/integration/workspace_symbol.rs b/support/texlab/tests/integration/workspace_symbol.rs new file mode 100644 index 0000000000..5eb8e1ace7 --- /dev/null +++ b/support/texlab/tests/integration/workspace_symbol.rs @@ -0,0 +1,228 @@ +use indoc::indoc; +use texlab::{ + protocol::{Location, Range, RangeExt, SymbolInformation, WorkspaceSymbolParams}, + test::{TestBed, TestBedBuilder, TestLspClient, PULL_CAPABILITIES}, +}; + +pub fn verify_symbol_info( + symbol: &SymbolInformation, + test_bed: &TestBed, + relative_path: &str, + name: &str, + start_line: u64, + start_character: u64, + end_line: u64, + end_character: u64, +) { + assert_eq!(symbol.name, name); + let range = Range::new_simple(start_line, start_character, end_line, end_character); + assert_eq!( + symbol.location, + Location::new(test_bed.uri(relative_path).into(), range) + ); +} + +async fn run(query: &str) -> (TestBed, Vec<SymbolInformation>) { + let mut test_bed = TestBedBuilder::new() + .file( + "foo.tex", + indoc!( + r#" + \documentclass{article} + \usepackage{caption} + \usepackage{amsmath} + \usepackage{amsthm} + % + \begin{document} + % + \section{Foo}\label{sec:foo} + % + \begin{equation}\label{eq:foo} + Foo + \end{equation} + % + \section{Bar}\label{sec:bar} + % + \begin{figure} + Bar + \caption{Bar} + \label{fig:bar} + \end{figure} + % + \section{Baz}\label{sec:baz} + % + \begin{enumerate} + \item\label{itm:foo} Foo + \item\label{itm:bar} Bar + \item\label{itm:baz} Baz + \end{enumerate} + % + \section{Qux}\label{sec:qux} + % + \newtheorem{lemma}{Lemma} + % + \begin{lemma}[Qux]\label{thm:qux} + Qux + \end{lemma} + % + \end{document} + "# + ), + ) + .file( + "foo.aux", + indoc!( + r#" + \relax + \@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Bar\relax }}{1}\protected@file@percent } + \providecommand*\caption@xref[2]{\@setref\relax\@undefined{#1}} + \newlabel{fig:bar}{{1}{1}} + \@writefile{toc}{\contentsline {section}{\numberline {1}Foo}{1}\protected@file@percent } + \newlabel{sec:foo}{{1}{1}} + \newlabel{eq:foo}{{1}{1}} + \@writefile{toc}{\contentsline {section}{\numberline {2}Bar}{1}\protected@file@percent } + \newlabel{sec:bar}{{2}{1}} + \@writefile{toc}{\contentsline {section}{\numberline {3}Baz}{1}\protected@file@percent } + \newlabel{sec:baz}{{3}{1}} + \newlabel{itm:foo}{{1}{1}} + \newlabel{itm:bar}{{2}{1}} + \newlabel{itm:baz}{{3}{1}} + \@writefile{toc}{\contentsline {section}{\numberline {4}Qux}{1}\protected@file@percent } + \newlabel{sec:qux}{{4}{1}} + \newlabel{thm:qux}{{1}{1}} + "# + ), + ) + .file( + "bar.bib", + indoc!( + r#" + @article{foo,} + % + @string{bar = "bar"} + "# + ), + ) + .build() + .await; + test_bed.spawn(); + test_bed.initialize(PULL_CAPABILITIES.clone()).await; + test_bed.open("foo.tex").await; + test_bed.open("foo.aux").await; + test_bed.open("bar.bib").await; + + let params = WorkspaceSymbolParams { + query: query.into(), + ..WorkspaceSymbolParams::default() + }; + let actual_symbols = test_bed.client.workspace_symbol(params).await.unwrap(); + + test_bed.shutdown().await; + + (test_bed, actual_symbols) +} + +#[tokio::test] +async fn filter_type_section() { + let (test_bed, actual_symbols) = run("section").await; + assert_eq!(actual_symbols.len(), 4); + verify_symbol_info( + &actual_symbols[0], + &test_bed, + "foo.tex", + "1 Foo", + 7, + 0, + 13, + 0, + ); + verify_symbol_info( + &actual_symbols[1], + &test_bed, + "foo.tex", + "2 Bar", + 13, + 0, + 21, + 0, + ); + verify_symbol_info( + &actual_symbols[2], + &test_bed, + "foo.tex", + "3 Baz", + 21, + 0, + 29, + 0, + ); + verify_symbol_info( + &actual_symbols[3], + &test_bed, + "foo.tex", + "4 Qux", + 29, + 0, + 37, + 0, + ); +} + +#[tokio::test] +async fn filter_type_figure() { + let (test_bed, actual_symbols) = run("figure").await; + assert_eq!(actual_symbols.len(), 1); + verify_symbol_info( + &actual_symbols[0], + &test_bed, + "foo.tex", + "Figure 1: Bar", + 15, + 0, + 19, + 12, + ); +} + +#[tokio::test] +async fn filter_type_item() { + let (test_bed, actual_symbols) = run("item").await; + assert_eq!(actual_symbols.len(), 3); + verify_symbol_info(&actual_symbols[0], &test_bed, "foo.tex", "1", 24, 4, 25, 4); + verify_symbol_info(&actual_symbols[1], &test_bed, "foo.tex", "2", 25, 4, 26, 4); + verify_symbol_info(&actual_symbols[2], &test_bed, "foo.tex", "3", 26, 4, 27, 0); +} + +#[tokio::test] +async fn filter_type_math() { + let (test_bed, actual_symbols) = run("math").await; + assert_eq!(actual_symbols.len(), 2); + verify_symbol_info( + &actual_symbols[0], + &test_bed, + "foo.tex", + "Equation (1)", + 9, + 0, + 11, + 14, + ); + verify_symbol_info( + &actual_symbols[1], + &test_bed, + "foo.tex", + "Lemma 1 (Qux)", + 33, + 0, + 35, + 11, + ); +} + +#[tokio::test] +async fn filter_bibtex() { + let (test_bed, actual_symbols) = run("bibtex").await; + assert_eq!(actual_symbols.len(), 2); + verify_symbol_info(&actual_symbols[0], &test_bed, "bar.bib", "foo", 0, 0, 0, 14); + verify_symbol_info(&actual_symbols[1], &test_bed, "bar.bib", "bar", 2, 0, 2, 20); +} diff --git a/support/texlab/tests/logs/bad-box.log b/support/texlab/tests/logs/bad-box.log deleted file mode 100644 index 39d13e0acd..0000000000 --- a/support/texlab/tests/logs/bad-box.log +++ /dev/null @@ -1,84 +0,0 @@ -This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/W32TeX) (preloaded format=pdflatex 2018.3.30) 26 DEC 2018 16:50 -entering extended mode - restricted \write18 enabled. - %&-line parsing enabled. -**./parent.tex -(./parent.tex -LaTeX2e <2017-04-15> -Babel <3.10> and hyphenation patterns for 84 language(s) loaded. -(/TexLive/texmf-dist/tex/latex/base/article.cls -Document Class: article 2014/09/29 v1.4h Standard LaTeX document class -(/TexLive/texmf-dist/tex/latex/base/size10.clo -File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option) -) -\c@part=\count79 -\c@section=\count80 -\c@subsection=\count81 -\c@subsubsection=\count82 -\c@paragraph=\count83 -\c@subparagraph=\count84 -\c@figure=\count85 -\c@table=\count86 -\abovecaptionskip=\skip41 -\belowcaptionskip=\skip42 -\bibindent=\dimen102 -) -(/TexLive/texmf-dist/tex/latex/multirow/bigstrut.sty -Package: bigstrut 2016/11/25 v2.2 Provide larger struts in tabulars -\bigstrutjot=\dimen103 -) -(/TexLive/texmf-dist/tex/latex/multirow/multirow.sty -Package: multirow 2016/11/25 v2.2 Span multiple rows of a table -\multirow@colwidth=\skip43 -\multirow@cntb=\count87 -\multirow@dima=\skip44 -) (./parent.aux) -\openout1 = `parent.aux'. - -LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 6. -LaTeX Font Info: ... okay on input line 6. -LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 6. -LaTeX Font Info: ... okay on input line 6. -LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 6. -LaTeX Font Info: ... okay on input line 6. -LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 6. -LaTeX Font Info: ... okay on input line 6. -LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 6. -LaTeX Font Info: ... okay on input line 6. -LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 6. -LaTeX Font Info: ... okay on input line 6. - -Overfull \hbox (200.00162pt too wide) in paragraph at lines 8--9 -[]\OT1/cmr/m/n/10 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - [] - -LaTeX Font Info: External font `cmex10' loaded for size -(Font) <7> on input line 11. -LaTeX Font Info: External font `cmex10' loaded for size -(Font) <5> on input line 11. - -Overfull \vbox (3.19998pt too high) detected at line 23 - [] - -[1 - -{/TexLive/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./parent.aux) ) -Here is how much of TeX's memory you used: - 265 strings out of 492995 - 3121 string characters out of 6138727 - 55074 words of memory out of 5000000 - 3896 multiletter control sequences out of 15000+600000 - 3640 words of font info for 14 fonts, out of 8000000 for 9000 - 1141 hyphenation exceptions out of 8191 - 23i,20n,20p,124b,282s stack positions out of 5000i,500n,10000p,200000b,80000s -</ -TexLive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></TexLive/texmf-d -ist/fonts/type1/public/amsfonts/cm/cmr7.pfb> -Output written on parent.pdf (1 page, 17505 bytes). -PDF statistics: - 16 PDF objects out of 1000 (max. 8388607) - 10 compressed objects within 1 object stream - 0 named destinations out of 1000 (max. 500000) - 1 words of extra memory for PDF output out of 10000 (max. 10000000) - diff --git a/support/texlab/tests/logs/child-error.log b/support/texlab/tests/logs/child-error.log deleted file mode 100644 index d40d9201f4..0000000000 --- a/support/texlab/tests/logs/child-error.log +++ /dev/null @@ -1,65 +0,0 @@ -This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/W32TeX) (preloaded format=pdflatex 2018.3.30) 26 DEC 2018 16:52 -entering extended mode - restricted \write18 enabled. - %&-line parsing enabled. -**./parent.tex -(./parent.tex -LaTeX2e <2017-04-15> -Babel <3.10> and hyphenation patterns for 84 language(s) loaded. -(/TexLive/texmf-dist/tex/latex/base/article.cls -Document Class: article 2014/09/29 v1.4h Standard LaTeX document class -(/TexLive/texmf-dist/tex/latex/base/size10.clo -File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option) -) -\c@part=\count79 -\c@section=\count80 -\c@subsection=\count81 -\c@subsubsection=\count82 -\c@paragraph=\count83 -\c@subparagraph=\count84 -\c@figure=\count85 -\c@table=\count86 -\abovecaptionskip=\skip41 -\belowcaptionskip=\skip42 -\bibindent=\dimen102 -) (./parent.aux (./child.aux)) -\openout1 = `parent.aux'. - -LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 4. -LaTeX Font Info: ... okay on input line 4. -LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 4. -LaTeX Font Info: ... okay on input line 4. -LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 4. -LaTeX Font Info: ... okay on input line 4. -LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 4. -LaTeX Font Info: ... okay on input line 4. -LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 4. -LaTeX Font Info: ... okay on input line 4. -LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 4. -LaTeX Font Info: ... okay on input line 4. -(./child.tex -! Undefined control sequence. -l.1 \foo - -The control sequence at the end of the top line -of your error message was never \def'ed. If you have -misspelled it (e.g., `\hobx'), type `I' and the correct -spelling (e.g., `I\hbox'). Otherwise just continue, -and I'll forget about whatever was undefined. - -) (./parent.aux) ) -Here is how much of TeX's memory you used: - 205 strings out of 492995 - 2149 string characters out of 6138727 - 54074 words of memory out of 5000000 - 3841 multiletter control sequences out of 15000+600000 - 3640 words of font info for 14 fonts, out of 8000000 for 9000 - 1141 hyphenation exceptions out of 8191 - 23i,1n,17p,116b,36s stack positions out of 5000i,500n,10000p,200000b,80000s - -No pages of output. -PDF statistics: - 0 PDF objects out of 1000 (max. 8388607) - 0 named destinations out of 1000 (max. 500000) - 1 words of extra memory for PDF output out of 10000 (max. 10000000) - diff --git a/support/texlab/tests/logs/citation-warning.log b/support/texlab/tests/logs/citation-warning.log deleted file mode 100644 index 0fae25fd4f..0000000000 --- a/support/texlab/tests/logs/citation-warning.log +++ /dev/null @@ -1,67 +0,0 @@ -This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/W32TeX) (preloaded format=pdflatex 2018.3.30) 26 DEC 2018 16:51 -entering extended mode - restricted \write18 enabled. - %&-line parsing enabled. -**./parent.tex -(./parent.tex -LaTeX2e <2017-04-15> -Babel <3.10> and hyphenation patterns for 84 language(s) loaded. -(/TexLive/texmf-dist/tex/latex/base/article.cls -Document Class: article 2014/09/29 v1.4h Standard LaTeX document class -(/TexLive/texmf-dist/tex/latex/base/size10.clo -File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option) -) -\c@part=\count79 -\c@section=\count80 -\c@subsection=\count81 -\c@subsubsection=\count82 -\c@paragraph=\count83 -\c@subparagraph=\count84 -\c@figure=\count85 -\c@table=\count86 -\abovecaptionskip=\skip41 -\belowcaptionskip=\skip42 -\bibindent=\dimen102 -) (./parent.aux) -\openout1 = `parent.aux'. - -LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 4. -LaTeX Font Info: ... okay on input line 4. -LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 4. -LaTeX Font Info: ... okay on input line 4. -LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 4. -LaTeX Font Info: ... okay on input line 4. -LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 4. -LaTeX Font Info: ... okay on input line 4. -LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 4. -LaTeX Font Info: ... okay on input line 4. -LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 4. -LaTeX Font Info: ... okay on input line 4. - - -LaTeX Warning: Citation `foo' on page 1 undefined on input line 6. - -[1 - -{/TexLive/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./parent.aux) - -LaTeX Warning: There were undefined references. - - ) -Here is how much of TeX's memory you used: - 204 strings out of 492995 - 2142 string characters out of 6138727 - 54074 words of memory out of 5000000 - 3842 multiletter control sequences out of 15000+600000 - 3948 words of font info for 15 fonts, out of 8000000 for 9000 - 1141 hyphenation exceptions out of 8191 - 23i,4n,21p,116b,107s stack positions out of 5000i,500n,10000p,200000b,80000s -</TexLive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></TexLive/ -texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb> -Output written on parent.pdf (1 page, 17339 bytes). -PDF statistics: - 16 PDF objects out of 1000 (max. 8388607) - 10 compressed objects within 1 object stream - 0 named destinations out of 1000 (max. 500000) - 1 words of extra memory for PDF output out of 10000 (max. 10000000) - diff --git a/support/texlab/tests/logs/package-error.log b/support/texlab/tests/logs/package-error.log deleted file mode 100644 index e79f1e851c..0000000000 --- a/support/texlab/tests/logs/package-error.log +++ /dev/null @@ -1,86 +0,0 @@ -This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/W32TeX) (preloaded format=pdflatex 2018.3.30) 26 DEC 2018 16:40 -entering extended mode - restricted \write18 enabled. - %&-line parsing enabled. -**./parent.tex -(./parent.tex -LaTeX2e <2017-04-15> -Babel <3.10> and hyphenation patterns for 84 language(s) loaded. -(/TexLive/texmf-dist/tex/latex/base/article.cls -Document Class: article 2014/09/29 v1.4h Standard LaTeX document class -(/TexLive/texmf-dist/tex/latex/base/size10.clo -File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option) -) -\c@part=\count79 -\c@section=\count80 -\c@subsection=\count81 -\c@subsubsection=\count82 -\c@paragraph=\count83 -\c@subparagraph=\count84 -\c@figure=\count85 -\c@table=\count86 -\abovecaptionskip=\skip41 -\belowcaptionskip=\skip42 -\bibindent=\dimen102 -) -(/TexLive/texmf-dist/tex/generic/babel/babel.sty -Package: babel 2017/05/19 3.10 The Babel package - - -! Package babel Error: Unknown option `foo'. Either you misspelled it -(babel) or the language definition file foo.ldf was not found. - -See the babel package documentation for explanation. -Type H <return> for immediate help. - ... - -l.393 \ProcessOptions* - -Valid options are: shorthands=, KeepShorthandsActive, -activeacute, activegrave, noconfigs, safe=, main=, math= -headfoot=, strings=, config=, hyphenmap=, or a language name. - - -! Package babel Error: You haven't specified a language option. - -See the babel package documentation for explanation. -Type H <return> for immediate help. - ... - -l.426 ...ry to proceed from here, type x to quit.} - -You need to specify a language, either as a global option -or as an optional argument to the \usepackage command; -You shouldn't try to proceed from here, type x to quit. - -) (./parent.aux) -\openout1 = `parent.aux'. - -LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 5. -LaTeX Font Info: ... okay on input line 5. -LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 5. -LaTeX Font Info: ... okay on input line 5. -LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 5. -LaTeX Font Info: ... okay on input line 5. -LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 5. -LaTeX Font Info: ... okay on input line 5. -LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 5. -LaTeX Font Info: ... okay on input line 5. -LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 5. -LaTeX Font Info: ... okay on input line 5. - (./parent.aux) ) -Here is how much of TeX's memory you used: - 304 strings out of 492995 - 3421 string characters out of 6138727 - 56035 words of memory out of 5000000 - 3938 multiletter control sequences out of 15000+600000 - 3640 words of font info for 14 fonts, out of 8000000 for 9000 - 1141 hyphenation exceptions out of 8191 - 23i,1n,17p,116b,36s stack positions out of 5000i,500n,10000p,200000b,80000s - -No pages of output. -PDF statistics: - 0 PDF objects out of 1000 (max. 8388607) - 0 named destinations out of 1000 (max. 500000) - 1 words of extra memory for PDF output out of 10000 (max. 10000000) - diff --git a/support/texlab/tests/logs/package-warning.log b/support/texlab/tests/logs/package-warning.log deleted file mode 100644 index f3c4769e52..0000000000 --- a/support/texlab/tests/logs/package-warning.log +++ /dev/null @@ -1,387 +0,0 @@ -This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/W32TeX) (preloaded format=pdflatex 2018.3.30) 26 DEC 2018 16:45 -entering extended mode - restricted \write18 enabled. - %&-line parsing enabled. -**./parent.tex -(./parent.tex -LaTeX2e <2017-04-15> -Babel <3.10> and hyphenation patterns for 84 language(s) loaded. -(/TexLive/texmf-dist/tex/latex/base/article.cls -Document Class: article 2014/09/29 v1.4h Standard LaTeX document class -(/TexLive/texmf-dist/tex/latex/base/size10.clo -File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option) -) -\c@part=\count79 -\c@section=\count80 -\c@subsection=\count81 -\c@subsubsection=\count82 -\c@paragraph=\count83 -\c@subparagraph=\count84 -\c@figure=\count85 -\c@table=\count86 -\abovecaptionskip=\skip41 -\belowcaptionskip=\skip42 -\bibindent=\dimen102 -) -(/TexLive/texmf-dist/tex/generic/babel/babel.sty -Package: babel 2017/05/19 3.10 The Babel package - -(/TexLive/texmf-dist/tex/generic/babel-spanish/spanish.ldf -Language: spanish.ldf 2016/03/03 v5.0p Spanish support from the babel system - -(/TexLive/texmf-dist/tex/generic/babel/babel.def -File: babel.def 2017/05/19 3.10 Babel common definitions -\babel@savecnt=\count87 -\U@D=\dimen103 -) -\es@quottoks=\toks14 -\es@quotdepth=\count88 -Package babel Info: Making " an active character on input line 561. -Package babel Info: Making . an active character on input line 662. -Package babel Info: Making < an active character on input line 707. -Package babel Info: Making > an active character on input line 707. -)) -(/TexLive/texmf-dist/tex/latex/biblatex/biblatex.sty -Package: biblatex 2016/12/05 v3.7 programmable bibliographies (PK/JW/AB) - -(/TexLive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty -Package: pdftexcmds 2017/03/19 v0.25 Utility functions of pdfTeX for LuaTeX (HO -) - -(/TexLive/texmf-dist/tex/generic/oberdiek/infwarerr.sty -Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO) -) -(/TexLive/texmf-dist/tex/generic/oberdiek/ifluatex.sty -Package: ifluatex 2016/05/16 v1.4 Provides the ifluatex switch (HO) -Package ifluatex Info: LuaTeX not detected. -) -(/TexLive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty -Package: ltxcmds 2016/05/16 v1.23 LaTeX kernel commands for general use (HO) -) -(/TexLive/texmf-dist/tex/generic/oberdiek/ifpdf.sty -Package: ifpdf 2017/03/15 v3.2 Provides the ifpdf switch -) -Package pdftexcmds Info: LuaTeX not detected. -Package pdftexcmds Info: \pdf@primitive is available. -Package pdftexcmds Info: \pdf@ifprimitive is available. -Package pdftexcmds Info: \pdfdraftmode found. -) -(/TexLive/texmf-dist/tex/latex/etoolbox/etoolbox.sty -Package: etoolbox 2017/01/02 v2.4 e-TeX tools for LaTeX (JAW) -\etb@tempcnta=\count89 -) -(/TexLive/texmf-dist/tex/latex/graphics/keyval.sty -Package: keyval 2014/10/28 v1.15 key=value parser (DPC) -\KV@toks@=\toks15 -) -(/TexLive/texmf-dist/tex/latex/oberdiek/kvoptions.sty -Package: kvoptions 2016/05/16 v3.12 Key value format for package options (HO) - -(/TexLive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty -Package: kvsetkeys 2016/05/16 v1.17 Key value parser (HO) - -(/TexLive/texmf-dist/tex/generic/oberdiek/etexcmds.sty -Package: etexcmds 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO) -Package etexcmds Info: Could not find \expanded. -(etexcmds) That can mean that you are not using pdfTeX 1.50 or -(etexcmds) that some package has redefined \expanded. -(etexcmds) In the latter case, load this package earlier. -))) -(/TexLive/texmf-dist/tex/latex/logreq/logreq.sty -Package: logreq 2010/08/04 v1.0 xml request logger -\lrq@indent=\count90 - -(/TexLive/texmf-dist/tex/latex/logreq/logreq.def -File: logreq.def 2010/08/04 v1.0 logreq spec v1.0 -)) -(/TexLive/texmf-dist/tex/latex/base/ifthen.sty -Package: ifthen 2014/09/29 v1.1c Standard LaTeX ifthen package (DPC) -) -(/TexLive/texmf-dist/tex/latex/url/url.sty -\Urlmuskip=\muskip10 -Package: url 2013/09/16 ver 3.4 Verb mode for urls, etc. -) -(/TexLive/texmf-dist/tex/generic/xstring/xstring.sty -(/TexLive/texmf-dist/tex/generic/xstring/xstring.tex -\@xs@message=\write3 -\integerpart=\count91 -\decimalpart=\count92 -) -Package: xstring 2013/10/13 v1.7c String manipulations (C Tellechea) -) -\c@tabx@nest=\count93 -\c@listtotal=\count94 -\c@listcount=\count95 -\c@liststart=\count96 -\c@liststop=\count97 -\c@citecount=\count98 -\c@citetotal=\count99 -\c@multicitecount=\count100 -\c@multicitetotal=\count101 -\c@instcount=\count102 -\c@maxnames=\count103 -\c@minnames=\count104 -\c@maxitems=\count105 -\c@minitems=\count106 -\c@citecounter=\count107 -\c@savedcitecounter=\count108 -\c@uniquelist=\count109 -\c@uniquename=\count110 -\c@refsection=\count111 -\c@refsegment=\count112 -\c@maxextratitle=\count113 -\c@maxextratitleyear=\count114 -\c@maxextrayear=\count115 -\c@maxextraalpha=\count116 -\c@abbrvpenalty=\count117 -\c@highnamepenalty=\count118 -\c@lownamepenalty=\count119 -\c@maxparens=\count120 -\c@parenlevel=\count121 -\blx@tempcnta=\count122 -\blx@tempcntb=\count123 -\blx@tempcntc=\count124 -\blx@maxsection=\count125 -\blx@maxsegment@0=\count126 -\blx@notetype=\count127 -\blx@parenlevel@text=\count128 -\blx@parenlevel@foot=\count129 -\blx@sectionciteorder@0=\count130 -\labelnumberwidth=\skip43 -\labelalphawidth=\skip44 -\biblabelsep=\skip45 -\bibitemsep=\skip46 -\bibnamesep=\skip47 -\bibinitsep=\skip48 -\bibparsep=\skip49 -\bibhang=\skip50 -\blx@bcfin=\read1 -\blx@bcfout=\write4 -\c@mincomprange=\count131 -\c@maxcomprange=\count132 -\c@mincompwidth=\count133 -Package biblatex Info: Trying to load biblatex default data model... -Package biblatex Info: ... file 'blx-dm.def' found. - -(/TexLive/texmf-dist/tex/latex/biblatex/blx-dm.def) -Package biblatex Info: Trying to load biblatex style data model... -Package biblatex Info: ... file 'ieee.dbx' not found. -Package biblatex Info: Trying to load biblatex custom data model... -Package biblatex Info: ... file 'biblatex-dm.cfg' not found. -\c@afterword=\count134 -\c@savedafterword=\count135 -\c@annotator=\count136 -\c@savedannotator=\count137 -\c@author=\count138 -\c@savedauthor=\count139 -\c@bookauthor=\count140 -\c@savedbookauthor=\count141 -\c@commentator=\count142 -\c@savedcommentator=\count143 -\c@editor=\count144 -\c@savededitor=\count145 -\c@editora=\count146 -\c@savededitora=\count147 -\c@editorb=\count148 -\c@savededitorb=\count149 -\c@editorc=\count150 -\c@savededitorc=\count151 -\c@foreword=\count152 -\c@savedforeword=\count153 -\c@holder=\count154 -\c@savedholder=\count155 -\c@introduction=\count156 -\c@savedintroduction=\count157 -\c@namea=\count158 -\c@savednamea=\count159 -\c@nameb=\count160 -\c@savednameb=\count161 -\c@namec=\count162 -\c@savednamec=\count163 -\c@translator=\count164 -\c@savedtranslator=\count165 -\c@shortauthor=\count166 -\c@savedshortauthor=\count167 -\c@shorteditor=\count168 -\c@savedshorteditor=\count169 -\c@labelname=\count170 -\c@savedlabelname=\count171 -\c@institution=\count172 -\c@savedinstitution=\count173 -\c@lista=\count174 -\c@savedlista=\count175 -\c@listb=\count176 -\c@savedlistb=\count177 -\c@listc=\count178 -\c@savedlistc=\count179 -\c@listd=\count180 -\c@savedlistd=\count181 -\c@liste=\count182 -\c@savedliste=\count183 -\c@listf=\count184 -\c@savedlistf=\count185 -\c@location=\count186 -\c@savedlocation=\count187 -\c@organization=\count188 -\c@savedorganization=\count189 -\c@origlocation=\count190 -\c@savedoriglocation=\count191 -\c@origpublisher=\count192 -\c@savedorigpublisher=\count193 -\c@publisher=\count194 -\c@savedpublisher=\count195 -\c@language=\count196 -\c@savedlanguage=\count197 -\c@pageref=\count198 -\c@savedpageref=\count199 -\shorthandwidth=\skip51 -\shortjournalwidth=\skip52 -\shortserieswidth=\skip53 -\shorttitlewidth=\skip54 -\shortauthorwidth=\skip55 -\shorteditorwidth=\skip56 -Package biblatex Info: Trying to load compatibility code... -Package biblatex Info: ... file 'blx-compat.def' found. - -(/TexLive/texmf-dist/tex/latex/biblatex/blx-compat.def -File: blx-compat.def 2016/12/05 v3.7 biblatex compatibility (PK/JW/AB) -) -Package biblatex Info: Trying to load generic definitions... -Package biblatex Info: ... file 'biblatex.def' found. - -(/TexLive/texmf-dist/tex/latex/biblatex/biblatex.def -File: biblatex.def 2016/12/05 v3.7 biblatex compatibility (PK/JW/AB) -\c@textcitecount=\count266 -\c@textcitetotal=\count267 -\c@textcitemaxnames=\count268 -\c@biburlnumpenalty=\count269 -\c@biburlucpenalty=\count270 -\c@biburllcpenalty=\count271 -\c@smartand=\count272 -) -Package biblatex Info: Trying to load bibliography style 'ieee'... -Package biblatex Info: ... file 'ieee.bbx' found. - -(/TexLive/texmf-dist/tex/latex/biblatex-ieee/ieee.bbx -File: ieee.bbx 2017/03/27 v1.2d biblatex bibliography style -Package biblatex Info: Trying to load bibliography style 'numeric-comp'... -Package biblatex Info: ... file 'numeric-comp.bbx' found. - -(/TexLive/texmf-dist/tex/latex/biblatex/bbx/numeric-comp.bbx -File: numeric-comp.bbx 2016/12/05 v3.7 biblatex bibliography style (PK/JW/AB) -Package biblatex Info: Trying to load bibliography style 'numeric'... -Package biblatex Info: ... file 'numeric.bbx' found. - -(/TexLive/texmf-dist/tex/latex/biblatex/bbx/numeric.bbx -File: numeric.bbx 2016/12/05 v3.7 biblatex bibliography style (PK/JW/AB) -Package biblatex Info: Trying to load bibliography style 'standard'... -Package biblatex Info: ... file 'standard.bbx' found. - -(/TexLive/texmf-dist/tex/latex/biblatex/bbx/standard.bbx -File: standard.bbx 2016/12/05 v3.7 biblatex bibliography style (PK/JW/AB) -\c@bbx:relatedcount=\count273 -\c@bbx:relatedtotal=\count274 -)))) -Package biblatex Info: Trying to load citation style 'ieee'... -Package biblatex Info: ... file 'ieee.cbx' found. - -(/TexLive/texmf-dist/tex/latex/biblatex-ieee/ieee.cbx -File: ieee.cbx 2017/03/27 v1.2d biblatex citation style -Package biblatex Info: Trying to load citation style 'numeric-comp'... -Package biblatex Info: ... file 'numeric-comp.cbx' found. - -(/TexLive/texmf-dist/tex/latex/biblatex/cbx/numeric-comp.cbx -File: numeric-comp.cbx 2016/12/05 v3.7 biblatex citation style (PK/JW/AB) -\c@cbx@tempcnta=\count275 -\c@cbx@tempcntb=\count276 -Package biblatex Info: Redefining '\cite'. -Package biblatex Info: Redefining '\parencite'. -Package biblatex Info: Redefining '\footcite'. -Package biblatex Info: Redefining '\footcitetext'. -Package biblatex Info: Redefining '\smartcite'. -Package biblatex Info: Redefining '\supercite'. -Package biblatex Info: Redefining '\textcite'. -Package biblatex Info: Redefining '\textcites'. -Package biblatex Info: Redefining '\cites'. -Package biblatex Info: Redefining '\parencites'. -Package biblatex Info: Redefining '\smartcites'. -) -Package biblatex Info: Redefining '\cite'. -Package biblatex Info: Redefining '\cites'. -) -Package biblatex Info: Trying to load configuration file... -Package biblatex Info: ... file 'biblatex.cfg' found. - -(/TexLive/texmf-dist/tex/latex/biblatex/biblatex.cfg -File: biblatex.cfg -)) -Package biblatex Info: Trying to load language 'spanish'... -Package biblatex Info: ... file 'spanish.lbx' found. - -(/TexLive/texmf-dist/tex/latex/biblatex/lbx/spanish.lbx -File: spanish.lbx 2016/12/05 v3.7 biblatex localization (PK/JW/AB) -) - -Package biblatex Warning: 'babel/polyglossia' detected but 'csquotes' missing. -(biblatex) Loading 'csquotes' recommended. - -\@quotelevel=\count277 -\@quotereset=\count278 -(./parent.aux) -\openout1 = `parent.aux'. - -LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 6. -LaTeX Font Info: ... okay on input line 6. -LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 6. -LaTeX Font Info: ... okay on input line 6. -LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 6. -LaTeX Font Info: ... okay on input line 6. -LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 6. -LaTeX Font Info: ... okay on input line 6. -LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 6. -LaTeX Font Info: ... okay on input line 6. -LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 6. -LaTeX Font Info: ... okay on input line 6. -LaTeX Info: Redefining \sptext on input line 6. -LaTeX Info: Redefining \. on input line 6. -LaTeX Info: Redefining \% on input line 6. -Package biblatex Info: No input encoding detected. -(biblatex) Assuming 'ascii'. -Package biblatex Info: Automatic encoding selection. -(biblatex) Assuming data encoding 'ascii'. -\openout4 = `parent.bcf'. - -Package biblatex Info: Trying to load bibliographic data... -Package biblatex Info: ... file 'parent.bbl' not found. - -No file parent.bbl. -Package biblatex Info: Reference section=0 on input line 6. -Package biblatex Info: Reference segment=0 on input line 6. -(./parent.aux) - -LaTeX Warning: There were undefined references. - - -Package biblatex Warning: Please (re)run Biber on the file: -(biblatex) parent -(biblatex) and rerun LaTeX afterwards. - -Package logreq Info: Writing requests to 'parent.run.xml'. -\openout1 = `parent.run.xml'. - - ) -Here is how much of TeX's memory you used: - 7717 strings out of 492995 - 133301 string characters out of 6138727 - 557258 words of memory out of 5000000 - 11248 multiletter control sequences out of 15000+600000 - 3640 words of font info for 14 fonts, out of 8000000 for 9000 - 1141 hyphenation exceptions out of 8191 - 35i,1n,30p,856b,700s stack positions out of 5000i,500n,10000p,200000b,80000s - -No pages of output. -PDF statistics: - 0 PDF objects out of 1000 (max. 8388607) - 0 named destinations out of 1000 (max. 500000) - 1 words of extra memory for PDF output out of 10000 (max. 10000000) - diff --git a/support/texlab/tests/logs/tex-error.log b/support/texlab/tests/logs/tex-error.log deleted file mode 100644 index 33648f7f66..0000000000 --- a/support/texlab/tests/logs/tex-error.log +++ /dev/null @@ -1,125 +0,0 @@ -This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/W32TeX) (preloaded format=pdflatex 2018.3.30) 26 DEC 2018 16:33 -entering extended mode - restricted \write18 enabled. - %&-line parsing enabled. -**./parent.tex -(./parent.tex -LaTeX2e <2017-04-15> -Babel <3.10> and hyphenation patterns for 84 language(s) loaded. -(/TexLive/texmf-dist/tex/latex/base/article.cls -Document Class: article 2014/09/29 v1.4h Standard LaTeX document class -(/TexLive/texmf-dist/tex/latex/base/size10.clo -File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option) -) -\c@part=\count79 -\c@section=\count80 -\c@subsection=\count81 -\c@subsubsection=\count82 -\c@paragraph=\count83 -\c@subparagraph=\count84 -\c@figure=\count85 -\c@table=\count86 -\abovecaptionskip=\skip41 -\belowcaptionskip=\skip42 -\bibindent=\dimen102 -) (./parent.aux -(./child.tex.aux)) -\openout1 = `parent.aux'. - -LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 3. -LaTeX Font Info: ... okay on input line 3. -LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 3. -LaTeX Font Info: ... okay on input line 3. -LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 3. -LaTeX Font Info: ... okay on input line 3. -LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 3. -LaTeX Font Info: ... okay on input line 3. -LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 3. -LaTeX Font Info: ... okay on input line 3. -LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 3. -LaTeX Font Info: ... okay on input line 3. -\openout2 = `child.aux'. - - (./child.tex) -! Undefined control sequence. -l.7 \foo - -The control sequence at the end of the top line -of your error message was never \def'ed. If you have -misspelled it (e.g., `\hobx'), type `I' and the correct -spelling (e.g., `I\hbox'). Otherwise just continue, -and I'll forget about whatever was undefined. - -! Missing $ inserted. -<inserted text> - $ -l.8 \bar - -I've inserted a begin-math/end-math symbol since I think -you left one out. Proceed, with fingers crossed. - -LaTeX Font Info: External font `cmex10' loaded for size -(Font) <7> on input line 8. -LaTeX Font Info: External font `cmex10' loaded for size -(Font) <5> on input line 8. -! Undefined control sequence. -l.9 \baz - -The control sequence at the end of the top line -of your error message was never \def'ed. If you have -misspelled it (e.g., `\hobx'), type `I' and the correct -spelling (e.g., `I\hbox'). Otherwise just continue, -and I'll forget about whatever was undefined. - -! Missing { inserted. -<to be read again> - \par -l.10 - -A left brace was mandatory here, so I've put one in. -You might want to delete and/or insert some corrections -so that I will find a matching right brace soon. -(If you're confused by all this, try typing `I}' now.) - -! Missing $ inserted. -<inserted text> - $ -l.10 - -I've inserted a begin-math/end-math symbol since I think -you left one out. Proceed, with fingers crossed. - -! Missing } inserted. -<inserted text> - } -l.10 - -I've inserted something that you may have forgotten. -(See the <inserted text> above.) -With luck, this will get me unwedged. But if you -really didn't forget anything, try typing `2' now; then -my insertion and my current dilemma will both disappear. - -[1 - - - -{/TexLive/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./parent.aux -(./child.aux)) ) -Here is how much of TeX's memory you used: - 212 strings out of 492995 - 2238 string characters out of 6138727 - 54074 words of memory out of 5000000 - 3843 multiletter control sequences out of 15000+600000 - 3640 words of font info for 14 fonts, out of 8000000 for 9000 - 1141 hyphenation exceptions out of 8191 - 23i,4n,17p,116b,107s stack positions out of 5000i,500n,10000p,200000b,80000s -</TexLive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb -> -Output written on parent.pdf (1 page, 8329 bytes). -PDF statistics: - 12 PDF objects out of 1000 (max. 8388607) - 7 compressed objects within 1 object stream - 0 named destinations out of 1000 (max. 500000) - 1 words of extra memory for PDF output out of 10000 (max. 10000000) - diff --git a/support/texlab/tests/scenarios/completion/bibtex/command/foo.bib b/support/texlab/tests/scenarios/completion/bibtex/command/foo.bib deleted file mode 100644 index 918669ba68..0000000000 --- a/support/texlab/tests/scenarios/completion/bibtex/command/foo.bib +++ /dev/null @@ -1,7 +0,0 @@ -@article{foo, - author = {\LaT -} - -@article{foo, - author = {\LaT} -} diff --git a/support/texlab/tests/scenarios/completion/bibtex/field/foo.bib b/support/texlab/tests/scenarios/completion/bibtex/field/foo.bib deleted file mode 100644 index 6a24acd646..0000000000 --- a/support/texlab/tests/scenarios/completion/bibtex/field/foo.bib +++ /dev/null @@ -1,6 +0,0 @@ -@article{foo, - titl - -@article{foo, - title = {} -}
\ No newline at end of file diff --git a/support/texlab/tests/scenarios/completion/bibtex/type/foo.bib b/support/texlab/tests/scenarios/completion/bibtex/type/foo.bib deleted file mode 100644 index 2c645612b9..0000000000 --- a/support/texlab/tests/scenarios/completion/bibtex/type/foo.bib +++ /dev/null @@ -1,3 +0,0 @@ -@ -@art -@article diff --git a/support/texlab/tests/scenarios/completion/bibtex/word/foo.bib b/support/texlab/tests/scenarios/completion/bibtex/word/foo.bib deleted file mode 100644 index b2b9e862db..0000000000 --- a/support/texlab/tests/scenarios/completion/bibtex/word/foo.bib +++ /dev/null @@ -1,8 +0,0 @@ - -@article{foo, - author = {}, -} - -@comment{foo, - author = {}, -} diff --git a/support/texlab/tests/scenarios/completion/latex/citation/bar.bib b/support/texlab/tests/scenarios/completion/latex/citation/bar.bib deleted file mode 100644 index d96336de26..0000000000 --- a/support/texlab/tests/scenarios/completion/latex/citation/bar.bib +++ /dev/null @@ -1,7 +0,0 @@ -@article{foo:2019, - author = {Foo Bar}, - title = {Baz Qux}, - year = {2019}, -} - -@article{bar:2005,} diff --git a/support/texlab/tests/scenarios/completion/latex/citation/foo.tex b/support/texlab/tests/scenarios/completion/latex/citation/foo.tex deleted file mode 100644 index fd75f22698..0000000000 --- a/support/texlab/tests/scenarios/completion/latex/citation/foo.tex +++ /dev/null @@ -1,8 +0,0 @@ -\documentclass{article} -\bibliography{bar} - -\begin{document} - -\cite{ - -\end{document}
\ No newline at end of file diff --git a/support/texlab/tests/scenarios/completion/latex/color/foo.tex b/support/texlab/tests/scenarios/completion/latex/color/foo.tex deleted file mode 100644 index 72df702d12..0000000000 --- a/support/texlab/tests/scenarios/completion/latex/color/foo.tex +++ /dev/null @@ -1,3 +0,0 @@ -\color{re} -\definecolor{foo}{ -\definecolorset{R} diff --git a/support/texlab/tests/scenarios/completion/latex/component/foo.tex b/support/texlab/tests/scenarios/completion/latex/component/foo.tex deleted file mode 100644 index 991b7f5f68..0000000000 --- a/support/texlab/tests/scenarios/completion/latex/component/foo.tex +++ /dev/null @@ -1,8 +0,0 @@ -\documentclass{book} -\usepackage{amsmath} -\chap -\varDel -\begin{theind} -\end{alig} -\begin{doc} -\vareps diff --git a/support/texlab/tests/scenarios/completion/latex/include/bar.tex b/support/texlab/tests/scenarios/completion/latex/include/bar.tex deleted file mode 100644 index e69de29bb2..0000000000 --- a/support/texlab/tests/scenarios/completion/latex/include/bar.tex +++ /dev/null diff --git a/support/texlab/tests/scenarios/completion/latex/include/bibliography.bib b/support/texlab/tests/scenarios/completion/latex/include/bibliography.bib deleted file mode 100644 index e69de29bb2..0000000000 --- a/support/texlab/tests/scenarios/completion/latex/include/bibliography.bib +++ /dev/null diff --git a/support/texlab/tests/scenarios/completion/latex/include/foo.tex b/support/texlab/tests/scenarios/completion/latex/include/foo.tex deleted file mode 100644 index 545f78c491..0000000000 --- a/support/texlab/tests/scenarios/completion/latex/include/foo.tex +++ /dev/null @@ -1,7 +0,0 @@ -\documentclass{article} - -\include{} -\input{} -\input{qux/} -\addbibresource{} - diff --git a/support/texlab/tests/scenarios/completion/latex/include/qux/baz.tex b/support/texlab/tests/scenarios/completion/latex/include/qux/baz.tex deleted file mode 100644 index e69de29bb2..0000000000 --- a/support/texlab/tests/scenarios/completion/latex/include/qux/baz.tex +++ /dev/null diff --git a/support/texlab/tests/scenarios/completion/latex/label/bar.aux b/support/texlab/tests/scenarios/completion/latex/label/bar.aux deleted file mode 100644 index 8d3449db60..0000000000 --- a/support/texlab/tests/scenarios/completion/latex/label/bar.aux +++ /dev/null @@ -1,25 +0,0 @@ -\relax -\@writefile{toc}{\contentsline {section}{\numberline {2}Bar}{2}\protected@file@percent } -\newlabel{sec:bar}{{2}{2}} -\@setckpt{bar}{ -\setcounter{page}{3} -\setcounter{equation}{2} -\setcounter{enumi}{0} -\setcounter{enumii}{0} -\setcounter{enumiii}{0} -\setcounter{enumiv}{0} -\setcounter{footnote}{0} -\setcounter{mpfootnote}{0} -\setcounter{part}{0} -\setcounter{section}{2} -\setcounter{subsection}{0} -\setcounter{subsubsection}{0} -\setcounter{paragraph}{0} -\setcounter{subparagraph}{0} -\setcounter{figure}{1} -\setcounter{table}{0} -\setcounter{parentequation}{0} -\setcounter{caption@flags}{0} -\setcounter{ContinuedFloat}{0} -\setcounter{lemma}{1} -} diff --git a/support/texlab/tests/scenarios/completion/latex/label/bar.tex b/support/texlab/tests/scenarios/completion/latex/label/bar.tex deleted file mode 100644 index 97dea2908f..0000000000 --- a/support/texlab/tests/scenarios/completion/latex/label/bar.tex +++ /dev/null @@ -1,6 +0,0 @@ -\section{Bar}% -\label{sec:bar} - -Lorem ipsum dolor sit amet. -\ref{} -\eqref{} diff --git a/support/texlab/tests/scenarios/completion/latex/label/foo.aux b/support/texlab/tests/scenarios/completion/latex/label/foo.aux deleted file mode 100644 index cc82940c6b..0000000000 --- a/support/texlab/tests/scenarios/completion/latex/label/foo.aux +++ /dev/null @@ -1,10 +0,0 @@ -\relax -\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Baz\relax }}{1}\protected@file@percent } -\providecommand*\caption@xref[2]{\@setref\relax\@undefined{#1}} -\newlabel{fig:baz}{{1}{1}} -\@writefile{toc}{\contentsline {section}{\numberline {1}Foo}{1}\protected@file@percent } -\newlabel{sec:foo}{{1}{1}} -\newlabel{eq:foo}{{1}{1}} -\newlabel{eq:bar}{{2}{1}} -\newlabel{thm:foo}{{1}{1}} -\@input{bar.aux} diff --git a/support/texlab/tests/scenarios/completion/latex/label/foo.tex b/support/texlab/tests/scenarios/completion/latex/label/foo.tex deleted file mode 100644 index c85be2fa36..0000000000 --- a/support/texlab/tests/scenarios/completion/latex/label/foo.tex +++ /dev/null @@ -1,36 +0,0 @@ -\documentclass{article} - -\usepackage{amsmath} -\usepackage{caption} -\usepackage{amsthm} -\newtheorem{lemma}{Lemma} - -\begin{document} - -\section{Foo}% -\label{sec:foo} - -\begin{equation}% -\label{eq:foo} - 1 + 1 = 2 -\end{equation} - -\begin{equation}% -\label{eq:bar} - 1 + 1 = 2 -\end{equation} - -\begin{figure}% -\LaTeX{} -\caption{Baz}% -\label{fig:baz} -\end{figure} - -\begin{lemma}% -\label{thm:foo} - 1 + 1 = 2 -\end{lemma} - -\include{bar} - -\end{document} diff --git a/support/texlab/tests/scenarios/completion/latex/preselect/foo.tex b/support/texlab/tests/scenarios/completion/latex/preselect/foo.tex deleted file mode 100644 index 9f62299192..0000000000 --- a/support/texlab/tests/scenarios/completion/latex/preselect/foo.tex +++ /dev/null @@ -1,3 +0,0 @@ -\begin{document} - -\end{ diff --git a/support/texlab/tests/scenarios/completion/latex/theorem/foo.tex b/support/texlab/tests/scenarios/completion/latex/theorem/foo.tex deleted file mode 100644 index 04b53ecd0e..0000000000 --- a/support/texlab/tests/scenarios/completion/latex/theorem/foo.tex +++ /dev/null @@ -1,5 +0,0 @@ -\documentclass{article} -\usepackage{amsthm} -\newtheorem{foo}{Foo} - -\begin{f} diff --git a/support/texlab/tests/scenarios/completion/latex/tikz/foo.tex b/support/texlab/tests/scenarios/completion/latex/tikz/foo.tex deleted file mode 100644 index fde20c6336..0000000000 --- a/support/texlab/tests/scenarios/completion/latex/tikz/foo.tex +++ /dev/null @@ -1,3 +0,0 @@ -\usepackage{tikz} -\usepgflibrary{} -\usetikzlibrary{} diff --git a/support/texlab/tests/scenarios/completion/latex/user/foo.tex b/support/texlab/tests/scenarios/completion/latex/user/foo.tex deleted file mode 100644 index e1bcaef2ab..0000000000 --- a/support/texlab/tests/scenarios/completion/latex/user/foo.tex +++ /dev/null @@ -1,5 +0,0 @@ -\foo -\fo -\begin{foo} -\end{foo} -\begin{fo} diff --git a/support/texlab/tests/scenarios/definition/bibtex/string/foo.bib b/support/texlab/tests/scenarios/definition/bibtex/string/foo.bib deleted file mode 100644 index 9326d87cdd..0000000000 --- a/support/texlab/tests/scenarios/definition/bibtex/string/foo.bib +++ /dev/null @@ -1,7 +0,0 @@ -@string{foo = "Foo"} - -@string{bar = "Bar"} - -@article{baz, - author = bar -} diff --git a/support/texlab/tests/scenarios/definition/latex/citation/bar.bib b/support/texlab/tests/scenarios/definition/latex/citation/bar.bib deleted file mode 100644 index af2d2d9e66..0000000000 --- a/support/texlab/tests/scenarios/definition/latex/citation/bar.bib +++ /dev/null @@ -1,3 +0,0 @@ -@article{foo,} - -@article{bar,} diff --git a/support/texlab/tests/scenarios/definition/latex/citation/baz.bib b/support/texlab/tests/scenarios/definition/latex/citation/baz.bib deleted file mode 100644 index af2d2d9e66..0000000000 --- a/support/texlab/tests/scenarios/definition/latex/citation/baz.bib +++ /dev/null @@ -1,3 +0,0 @@ -@article{foo,} - -@article{bar,} diff --git a/support/texlab/tests/scenarios/definition/latex/citation/foo.tex b/support/texlab/tests/scenarios/definition/latex/citation/foo.tex deleted file mode 100644 index a6d704b46d..0000000000 --- a/support/texlab/tests/scenarios/definition/latex/citation/foo.tex +++ /dev/null @@ -1,2 +0,0 @@ -\bibliography{bar} -\cite{bar} diff --git a/support/texlab/tests/scenarios/definition/latex/command/foo.tex b/support/texlab/tests/scenarios/definition/latex/command/foo.tex deleted file mode 100644 index 29b8ea127e..0000000000 --- a/support/texlab/tests/scenarios/definition/latex/command/foo.tex +++ /dev/null @@ -1,3 +0,0 @@ -\newcommand{\foo}{Foo} - -\foo diff --git a/support/texlab/tests/scenarios/definition/latex/label/default.tex b/support/texlab/tests/scenarios/definition/latex/label/default.tex deleted file mode 100644 index 263c0e861e..0000000000 --- a/support/texlab/tests/scenarios/definition/latex/label/default.tex +++ /dev/null @@ -1,2 +0,0 @@ -\label{foo} -\ref{foo} diff --git a/support/texlab/tests/scenarios/definition/latex/label/equation.tex b/support/texlab/tests/scenarios/definition/latex/label/equation.tex deleted file mode 100644 index 436d886457..0000000000 --- a/support/texlab/tests/scenarios/definition/latex/label/equation.tex +++ /dev/null @@ -1,6 +0,0 @@ -\begin{equation}% -\label{eq:foo} - Foo -\end{equation} - -\ref{eq:foo} diff --git a/support/texlab/tests/scenarios/definition/latex/label/float.tex b/support/texlab/tests/scenarios/definition/latex/label/float.tex deleted file mode 100644 index 9f3cd97fae..0000000000 --- a/support/texlab/tests/scenarios/definition/latex/label/float.tex +++ /dev/null @@ -1,7 +0,0 @@ -\begin{figure} -Foo -\caption{Bar} -\label{fig} -\end{figure} - -\ref{fig} diff --git a/support/texlab/tests/scenarios/definition/latex/label/item.tex b/support/texlab/tests/scenarios/definition/latex/label/item.tex deleted file mode 100644 index a04034f0f8..0000000000 --- a/support/texlab/tests/scenarios/definition/latex/label/item.tex +++ /dev/null @@ -1,7 +0,0 @@ -\begin{enumerate} - \item Foo - \item\label{bar} Bar - \item Baz -\end{enumerate} - -\ref{bar} diff --git a/support/texlab/tests/scenarios/definition/latex/label/section.tex b/support/texlab/tests/scenarios/definition/latex/label/section.tex deleted file mode 100644 index 9dd7eeec33..0000000000 --- a/support/texlab/tests/scenarios/definition/latex/label/section.tex +++ /dev/null @@ -1,7 +0,0 @@ -\section{Foo} -\label{sec:foo} - -\section{Bar} -\label{sec:bar} - -\ref{sec:foo} diff --git a/support/texlab/tests/scenarios/definition/latex/label/theorem.tex b/support/texlab/tests/scenarios/definition/latex/label/theorem.tex deleted file mode 100644 index 52cac48394..0000000000 --- a/support/texlab/tests/scenarios/definition/latex/label/theorem.tex +++ /dev/null @@ -1,9 +0,0 @@ -\usepackage{amsthm} -\newtheorem{lemma}{Lemma} - -\begin{lemma}% -\label{thm:foo} - Foo -\end{lemma} - -\ref{thm:foo} diff --git a/support/texlab/tests/scenarios/definition/latex/math_operator/foo.tex b/support/texlab/tests/scenarios/definition/latex/math_operator/foo.tex deleted file mode 100644 index 1953dc269c..0000000000 --- a/support/texlab/tests/scenarios/definition/latex/math_operator/foo.tex +++ /dev/null @@ -1,3 +0,0 @@ -\DeclareMathOperator{\foo}{foo} - -\foo diff --git a/support/texlab/tests/scenarios/diagnostics/bibtex/foo.bib b/support/texlab/tests/scenarios/diagnostics/bibtex/foo.bib deleted file mode 100644 index 43890b16c1..0000000000 --- a/support/texlab/tests/scenarios/diagnostics/bibtex/foo.bib +++ /dev/null @@ -1 +0,0 @@ -@article diff --git a/support/texlab/tests/scenarios/diagnostics/build/foo.log b/support/texlab/tests/scenarios/diagnostics/build/foo.log deleted file mode 100644 index e51517e553..0000000000 --- a/support/texlab/tests/scenarios/diagnostics/build/foo.log +++ /dev/null @@ -1,59 +0,0 @@ -This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018/Arch Linux) (preloaded format=latex 2019.4.26) 31 MAY 2019 17:55 -entering extended mode - restricted \write18 enabled. - %&-line parsing enabled. -**foo.tex -(./foo.tex -LaTeX2e <2018-12-01> -(/usr/share/texmf-dist/tex/latex/base/article.cls -Document Class: article 2018/09/03 v1.4i Standard LaTeX document class -(/usr/share/texmf-dist/tex/latex/base/size10.clo -File: size10.clo 2018/09/03 v1.4i Standard LaTeX file (size option) -) -\c@part=\count80 -\c@section=\count81 -\c@subsection=\count82 -\c@subsubsection=\count83 -\c@paragraph=\count84 -\c@subparagraph=\count85 -\c@figure=\count86 -\c@table=\count87 -\abovecaptionskip=\skip41 -\belowcaptionskip=\skip42 -\bibindent=\dimen102 -) (./foo.aux) -\openout1 = `foo.aux'. - -LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. - -! Undefined control sequence. -l.4 \foo - -The control sequence at the end of the top line -of your error message was never \def'ed. If you have -misspelled it (e.g., `\hobx'), type `I' and the correct -spelling (e.g., `I\hbox'). Otherwise just continue, -and I'll forget about whatever was undefined. - -(./foo.aux) ) -Here is how much of TeX's memory you used: - 199 strings out of 492617 - 2074 string characters out of 6135203 - 59592 words of memory out of 5000000 - 4199 multiletter control sequences out of 15000+600000 - 3640 words of font info for 14 fonts, out of 8000000 for 9000 - 1141 hyphenation exceptions out of 8191 - 23i,1n,17p,127b,36s stack positions out of 5000i,500n,10000p,200000b,80000s - -No pages of output. diff --git a/support/texlab/tests/scenarios/diagnostics/build/foo.tex b/support/texlab/tests/scenarios/diagnostics/build/foo.tex deleted file mode 100644 index d8c1e22e35..0000000000 --- a/support/texlab/tests/scenarios/diagnostics/build/foo.tex +++ /dev/null @@ -1,6 +0,0 @@ -\documentclass{article} -\begin{document} - -\foo - -\end{document} diff --git a/support/texlab/tests/scenarios/folding/bar.bib b/support/texlab/tests/scenarios/folding/bar.bib deleted file mode 100644 index a292b387fb..0000000000 --- a/support/texlab/tests/scenarios/folding/bar.bib +++ /dev/null @@ -1,24 +0,0 @@ -@preamble{"Foo Bar Baz"} - -@string{foo = "foo"} - -@article{Rivest:1978:MOD:359340.359342, - author = {Rivest, R. L. and Shamir, A. and Adleman, L.}, - title = {A Method for Obtaining Digital Signatures and Public-key Cryptosystems}, - journal = {Commun. ACM}, - issue_date = {Feb. 1978}, - volume = {21}, - number = {2}, - month = feb, - year = {1978}, - issn = {0001-0782}, - pages = {120--126}, - numpages = {7}, - url = {http://doi.acm.org/10.1145/359340.359342}, - doi = {10.1145/359340.359342}, - acmid = {359342}, - publisher = {ACM}, - address = {New York, NY, USA}, - keywords = {authentication, cryptography, digital signatures, electronic funds transfer, electronic mail, - factorization, message-passing, prime number, privacy, public-key cryptosystems, security}, -} diff --git a/support/texlab/tests/scenarios/folding/foo.tex b/support/texlab/tests/scenarios/folding/foo.tex deleted file mode 100644 index a742bad397..0000000000 --- a/support/texlab/tests/scenarios/folding/foo.tex +++ /dev/null @@ -1,13 +0,0 @@ -\documentclass{article} - -\usepackage{amsmath} - -\begin{document} - -\section{Foo} - -\subsection{Bar} - -\section{Baz} - -\end{document} diff --git a/support/texlab/tests/scenarios/formatting/bibtex/default/formatted.bib b/support/texlab/tests/scenarios/formatting/bibtex/default/formatted.bib deleted file mode 100644 index 1044ed1efd..0000000000 --- a/support/texlab/tests/scenarios/formatting/bibtex/default/formatted.bib +++ /dev/null @@ -1,4 +0,0 @@ -@article{foo, - author = {Foo Bar}, - title = {Baz Qux}, -}
\ No newline at end of file diff --git a/support/texlab/tests/scenarios/formatting/bibtex/default/unformatted.bib b/support/texlab/tests/scenarios/formatting/bibtex/default/unformatted.bib deleted file mode 100644 index e8d1b9c403..0000000000 --- a/support/texlab/tests/scenarios/formatting/bibtex/default/unformatted.bib +++ /dev/null @@ -1 +0,0 @@ -@article{foo, author = {Foo Bar}, title = {Baz Qux}} diff --git a/support/texlab/tests/scenarios/formatting/bibtex/infinite_line_length/formatted.bib b/support/texlab/tests/scenarios/formatting/bibtex/infinite_line_length/formatted.bib deleted file mode 100644 index febd1a8079..0000000000 --- a/support/texlab/tests/scenarios/formatting/bibtex/infinite_line_length/formatted.bib +++ /dev/null @@ -1,3 +0,0 @@ -@article{foo, - title = {Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}, -}
\ No newline at end of file diff --git a/support/texlab/tests/scenarios/formatting/bibtex/infinite_line_length/unformatted.bib b/support/texlab/tests/scenarios/formatting/bibtex/infinite_line_length/unformatted.bib deleted file mode 100644 index 3ef68c5756..0000000000 --- a/support/texlab/tests/scenarios/formatting/bibtex/infinite_line_length/unformatted.bib +++ /dev/null @@ -1 +0,0 @@ -@article{foo, title = {Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.} } diff --git a/support/texlab/tests/scenarios/hover/bibtex/field/foo.bib b/support/texlab/tests/scenarios/hover/bibtex/field/foo.bib deleted file mode 100644 index 9d0a961b7a..0000000000 --- a/support/texlab/tests/scenarios/hover/bibtex/field/foo.bib +++ /dev/null @@ -1,4 +0,0 @@ -@article{foo, - author = {Foo Bar}, - bar = {Baz Qux}, -}
\ No newline at end of file diff --git a/support/texlab/tests/scenarios/hover/bibtex/string_reference/foo.bib b/support/texlab/tests/scenarios/hover/bibtex/string_reference/foo.bib deleted file mode 100644 index 434bb80185..0000000000 --- a/support/texlab/tests/scenarios/hover/bibtex/string_reference/foo.bib +++ /dev/null @@ -1,6 +0,0 @@ -@string{foo = "foo {bar} baz"} - -@article{bar, - author = foo # bar, - title = "Qux", -} diff --git a/support/texlab/tests/scenarios/hover/bibtex/type/foo.bib b/support/texlab/tests/scenarios/hover/bibtex/type/foo.bib deleted file mode 100644 index 708bf7bbff..0000000000 --- a/support/texlab/tests/scenarios/hover/bibtex/type/foo.bib +++ /dev/null @@ -1,5 +0,0 @@ -@article{foo,} - -@bar{bar,} - -@baz{baz,} diff --git a/support/texlab/tests/scenarios/hover/latex/citation/foo.bib b/support/texlab/tests/scenarios/hover/latex/citation/foo.bib deleted file mode 100644 index ce704dcff8..0000000000 --- a/support/texlab/tests/scenarios/hover/latex/citation/foo.bib +++ /dev/null @@ -1,5 +0,0 @@ -@article{foo, author = {Foo Bar}, title = {Baz Qux}, year = {2019}} - -@article{bar, author = {Baz Qux}, title = {Foo Bar}, year = {2019}} - -@article{baz,} diff --git a/support/texlab/tests/scenarios/hover/latex/citation/foo.tex b/support/texlab/tests/scenarios/hover/latex/citation/foo.tex deleted file mode 100644 index 7ec4a6cdf2..0000000000 --- a/support/texlab/tests/scenarios/hover/latex/citation/foo.tex +++ /dev/null @@ -1,4 +0,0 @@ -\bibliography{foo} - -\cite{foo} -\cite{baz} diff --git a/support/texlab/tests/scenarios/hover/latex/component/foo.tex b/support/texlab/tests/scenarios/hover/latex/component/foo.tex deleted file mode 100644 index c111318484..0000000000 --- a/support/texlab/tests/scenarios/hover/latex/component/foo.tex +++ /dev/null @@ -1,4 +0,0 @@ -\documentclass{article} -\usepackage{amsmath} -\documentclass{foo} -\usepackage{foo} diff --git a/support/texlab/tests/scenarios/hover/latex/label/section.tex b/support/texlab/tests/scenarios/hover/latex/label/section.tex deleted file mode 100644 index 75a5d120b5..0000000000 --- a/support/texlab/tests/scenarios/hover/latex/label/section.tex +++ /dev/null @@ -1,5 +0,0 @@ -\documentclass{article} -\begin{document} -\section{Foo} -\label{sec:foo} -\end{document} diff --git a/support/texlab/tests/scenarios/symbol/hierarchical/enumerate.aux b/support/texlab/tests/scenarios/symbol/hierarchical/enumerate.aux deleted file mode 100644 index 40fcc334fa..0000000000 --- a/support/texlab/tests/scenarios/symbol/hierarchical/enumerate.aux +++ /dev/null @@ -1,3 +0,0 @@ -\relax -\newlabel{it:foo}{{1}{1}} -\newlabel{it:qux}{{2}{1}} diff --git a/support/texlab/tests/scenarios/symbol/hierarchical/enumerate.tex b/support/texlab/tests/scenarios/symbol/hierarchical/enumerate.tex deleted file mode 100644 index bbf85f2ee6..0000000000 --- a/support/texlab/tests/scenarios/symbol/hierarchical/enumerate.tex +++ /dev/null @@ -1,12 +0,0 @@ -\documentclass{article} - -\begin{document} - -\begin{enumerate} - \item\label{it:foo} Foo - \item\label{it:bar} Bar - \item[Baz] Baz - \item[Qux]\label{it:qux} Qux -\end{enumerate} - -\end{document} diff --git a/support/texlab/tests/scenarios/symbol/hierarchical/equation.aux b/support/texlab/tests/scenarios/symbol/hierarchical/equation.aux deleted file mode 100644 index f7d3f25421..0000000000 --- a/support/texlab/tests/scenarios/symbol/hierarchical/equation.aux +++ /dev/null @@ -1,2 +0,0 @@ -\relax -\newlabel{eq:foo}{{1}{1}} diff --git a/support/texlab/tests/scenarios/symbol/hierarchical/equation.tex b/support/texlab/tests/scenarios/symbol/hierarchical/equation.tex deleted file mode 100644 index 0999f270fa..0000000000 --- a/support/texlab/tests/scenarios/symbol/hierarchical/equation.tex +++ /dev/null @@ -1,17 +0,0 @@ -\documentclass{article} - -\begin{document} - -\begin{equation}\label{eq:foo} - Foo -\end{equation} - -\begin{equation}\label{eq:bar} - Bar -\end{equation} - -\begin{equation} - Baz -\end{equation} - -\end{document} diff --git a/support/texlab/tests/scenarios/symbol/hierarchical/float.aux b/support/texlab/tests/scenarios/symbol/hierarchical/float.aux deleted file mode 100644 index a23cc632d1..0000000000 --- a/support/texlab/tests/scenarios/symbol/hierarchical/float.aux +++ /dev/null @@ -1,5 +0,0 @@ -\relax -\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Foo}}{1}\protected@file@percent } -\newlabel{fig:foo}{{1}{1}} -\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces Bar}}{1}\protected@file@percent } -\@writefile{lof}{\contentsline {figure}{\numberline {3}{\ignorespaces Baz}}{1}\protected@file@percent } diff --git a/support/texlab/tests/scenarios/symbol/hierarchical/float.tex b/support/texlab/tests/scenarios/symbol/hierarchical/float.tex deleted file mode 100644 index e8f65b9f3a..0000000000 --- a/support/texlab/tests/scenarios/symbol/hierarchical/float.tex +++ /dev/null @@ -1,24 +0,0 @@ -\documentclass{article} - -\begin{document} - -\begin{figure} - Foo - \caption{Foo}\label{fig:foo} -\end{figure} - -\begin{figure} - Bar - \caption{Bar}\label{fig:bar} -\end{figure} - -\begin{figure} - Baz - \caption{Baz} -\end{figure} - -\begin{figure} - Qux -\end{figure} - -\end{document} diff --git a/support/texlab/tests/scenarios/symbol/hierarchical/section.aux b/support/texlab/tests/scenarios/symbol/hierarchical/section.aux deleted file mode 100644 index d8c1d2c24f..0000000000 --- a/support/texlab/tests/scenarios/symbol/hierarchical/section.aux +++ /dev/null @@ -1,4 +0,0 @@ -\relax -\@writefile{toc}{\contentsline {section}{\numberline {1}Foo}{1}\protected@file@percent } -\@writefile{toc}{\contentsline {section}{\numberline {2}Bar}{1}\protected@file@percent } -\newlabel{sec:bar}{{2}{1}} diff --git a/support/texlab/tests/scenarios/symbol/hierarchical/section.tex b/support/texlab/tests/scenarios/symbol/hierarchical/section.tex deleted file mode 100644 index ca2de74578..0000000000 --- a/support/texlab/tests/scenarios/symbol/hierarchical/section.tex +++ /dev/null @@ -1,11 +0,0 @@ -\documentclass{article} - -\begin{document} - -\section{Foo} - -\section{Bar}\label{sec:bar} - -\subsection{Baz}\label{sec:baz} - -\end{document} diff --git a/support/texlab/tests/scenarios/symbol/hierarchical/theorem.aux b/support/texlab/tests/scenarios/symbol/hierarchical/theorem.aux deleted file mode 100644 index ad163aeeae..0000000000 --- a/support/texlab/tests/scenarios/symbol/hierarchical/theorem.aux +++ /dev/null @@ -1,3 +0,0 @@ -\relax -\newlabel{thm:foo}{{1}{1}} -\newlabel{thm:bar}{{2}{1}} diff --git a/support/texlab/tests/scenarios/symbol/hierarchical/theorem.tex b/support/texlab/tests/scenarios/symbol/hierarchical/theorem.tex deleted file mode 100644 index e147cd6f90..0000000000 --- a/support/texlab/tests/scenarios/symbol/hierarchical/theorem.tex +++ /dev/null @@ -1,23 +0,0 @@ -\documentclass{article} -\usepackage{amsthm} -\newtheorem{lemma}{Lemma} - -\begin{document} - -\begin{lemma}[Foo]\label{thm:foo} - Foo -\end{lemma} - -\begin{lemma}\label{thm:bar} - Bar -\end{lemma} - -\begin{lemma}\label{thm:baz} - Baz -\end{lemma} - -\begin{lemma}[Qux] - Qux -\end{lemma} - -\end{document}
\ No newline at end of file diff --git a/support/texlab/tests/scenarios/symbol/workspace/bar.bib b/support/texlab/tests/scenarios/symbol/workspace/bar.bib deleted file mode 100644 index 1fd540db29..0000000000 --- a/support/texlab/tests/scenarios/symbol/workspace/bar.bib +++ /dev/null @@ -1,3 +0,0 @@ -@article{foo,} - -@string{bar = "bar"} diff --git a/support/texlab/tests/scenarios/symbol/workspace/foo.aux b/support/texlab/tests/scenarios/symbol/workspace/foo.aux deleted file mode 100644 index 9713a1f333..0000000000 --- a/support/texlab/tests/scenarios/symbol/workspace/foo.aux +++ /dev/null @@ -1,17 +0,0 @@ -\relax -\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Bar\relax }}{1}\protected@file@percent } -\providecommand*\caption@xref[2]{\@setref\relax\@undefined{#1}} -\newlabel{fig:bar}{{1}{1}} -\@writefile{toc}{\contentsline {section}{\numberline {1}Foo}{1}\protected@file@percent } -\newlabel{sec:foo}{{1}{1}} -\newlabel{eq:foo}{{1}{1}} -\@writefile{toc}{\contentsline {section}{\numberline {2}Bar}{1}\protected@file@percent } -\newlabel{sec:bar}{{2}{1}} -\@writefile{toc}{\contentsline {section}{\numberline {3}Baz}{1}\protected@file@percent } -\newlabel{sec:baz}{{3}{1}} -\newlabel{itm:foo}{{1}{1}} -\newlabel{itm:bar}{{2}{1}} -\newlabel{itm:baz}{{3}{1}} -\@writefile{toc}{\contentsline {section}{\numberline {4}Qux}{1}\protected@file@percent } -\newlabel{sec:qux}{{4}{1}} -\newlabel{thm:qux}{{1}{1}} diff --git a/support/texlab/tests/scenarios/symbol/workspace/foo.tex b/support/texlab/tests/scenarios/symbol/workspace/foo.tex deleted file mode 100644 index 292cc5369b..0000000000 --- a/support/texlab/tests/scenarios/symbol/workspace/foo.tex +++ /dev/null @@ -1,38 +0,0 @@ -\documentclass{article} -\usepackage{caption} -\usepackage{amsmath} -\usepackage{amsthm} - -\begin{document} - -\section{Foo}\label{sec:foo} - -\begin{equation}\label{eq:foo} - Foo -\end{equation} - -\section{Bar}\label{sec:bar} - -\begin{figure} - Bar - \caption{Bar} - \label{fig:bar} -\end{figure} - -\section{Baz}\label{sec:baz} - -\begin{enumerate} - \item\label{itm:foo} Foo - \item\label{itm:bar} Bar - \item\label{itm:baz} Baz -\end{enumerate} - -\section{Qux}\label{sec:qux} - -\newtheorem{lemma}{Lemma} - -\begin{lemma}[Qux]\label{thm:qux} - Qux -\end{lemma} - -\end{document} diff --git a/support/texlab/tests/support/mod.rs b/support/texlab/tests/support/mod.rs deleted file mode 100644 index abd1bfe313..0000000000 --- a/support/texlab/tests/support/mod.rs +++ /dev/null @@ -1,635 +0,0 @@ -use copy_dir::copy_dir; -use futures::lock::Mutex; -use futures_boxed::boxed; -use jsonrpc::client::Result; -use lsp_types::*; -use serde::Serialize; -use std::collections::HashMap; -use std::fs::remove_dir; -use std::path::PathBuf; -use std::sync::Arc; -use tempfile::{tempdir, TempDir}; -use texlab::build::BuildOptions; -use texlab::client::LspClient; -use texlab::diagnostics::LatexLintOptions; -use texlab::formatting::bibtex::BibtexFormattingOptions; -use texlab::server::LatexLspServer; -use texlab::workspace::Uri; - -#[derive(Debug, PartialEq, Eq, Clone, Default)] -pub struct MockLspClientOptions { - pub bibtex_formatting: Option<BibtexFormattingOptions>, - pub latex_lint: Option<LatexLintOptions>, - pub latex_build: Option<BuildOptions>, -} - -#[derive(Debug, Default)] -pub struct MockLspClient { - pub messages: Mutex<Vec<ShowMessageParams>>, - pub options: Mutex<MockLspClientOptions>, - pub diagnostics_by_uri: Mutex<HashMap<Uri, Vec<Diagnostic>>>, - pub log_messages: Mutex<Vec<LogMessageParams>>, -} - -impl MockLspClient { - pub fn new() -> Self { - Self::default() - } -} - -impl LspClient for MockLspClient { - #[boxed] - async fn configuration(&self, params: ConfigurationParams) -> Result<serde_json::Value> { - fn serialize<T>(options: &Option<T>) -> Result<serde_json::Value> - where - T: Serialize, - { - options - .as_ref() - .map(|options| serde_json::to_value(vec![options]).unwrap()) - .ok_or_else(|| jsonrpc::Error::internal_error("Internal error".to_owned())) - } - - let options = self.options.lock().await; - match params.items[0].section.as_ref().unwrap().as_ref() { - "bibtex.formatting" => serialize(&options.bibtex_formatting), - "latex.lint" => serialize(&options.latex_lint), - "latex.build" => serialize(&options.latex_build), - _ => panic!("Invalid language configuration!"), - } - } - - #[boxed] - async fn show_message(&self, params: ShowMessageParams) { - let mut messages = self.messages.lock().await; - messages.push(params); - } - - #[boxed] - async fn register_capability(&self, _params: RegistrationParams) -> Result<()> { - Ok(()) - } - - #[boxed] - async fn publish_diagnostics(&self, params: PublishDiagnosticsParams) { - let mut diagnostics_by_uri = self.diagnostics_by_uri.lock().await; - diagnostics_by_uri.insert(params.uri.into(), params.diagnostics); - } - - #[boxed] - async fn work_done_progress_create(&self, _params: WorkDoneProgressCreateParams) -> Result<()> { - Ok(()) - } - - #[boxed] - async fn progress(&self, _params: ProgressParams) {} - - #[boxed] - async fn log_message(&self, params: LogMessageParams) { - let mut messages = self.log_messages.lock().await; - messages.push(params); - } -} - -pub struct Scenario { - pub directory: TempDir, - pub server: LatexLspServer<MockLspClient>, - pub client: Arc<MockLspClient>, -} - -impl Scenario { - pub fn new(name: &str, distribution: Arc<Box<dyn tex::Distribution>>) -> Self { - let directory = tempdir().unwrap(); - remove_dir(directory.path()).unwrap(); - let source = PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .join("tests") - .join("scenarios") - .join(name); - copy_dir(source, directory.path()).unwrap(); - - let client = Arc::new(MockLspClient::new()); - let server = LatexLspServer::new(distribution, Arc::clone(&client)); - Self { - directory, - server, - client, - } - } - - pub async fn initialize(&self, capabilities: &ClientCapabilities) { - let root_uri = Uri::from_file_path(self.directory.path()).unwrap(); - let params = InitializeParams { - process_id: None, - root_path: Some(self.directory.path().to_string_lossy().into_owned()), - root_uri: Some(root_uri.into()), - initialization_options: None, - capabilities: capabilities.clone(), - trace: None, - workspace_folders: None, - }; - - self.server - .execute_async(|svr| svr.initialize(params)) - .await - .unwrap(); - - self.server - .execute(|svr| svr.initialized(InitializedParams {})) - .await; - } - - pub fn uri(&self, name: &str) -> Uri { - let mut path = self.directory.path().to_owned(); - path.push(name); - Uri::from_file_path(path).unwrap() - } - - pub async fn read(&self, name: &'static str) -> String { - let mut path = self.directory.path().to_owned(); - path.push(name); - let data = tokio::fs::read(path).await.unwrap(); - let text = String::from_utf8_lossy(&data); - text.replace('\r', "") - } - - pub async fn open(&self, name: &'static str) { - let text = self.read(name).await; - let language_id = if name.ends_with(".bib") { - "bibtex" - } else { - "latex" - }; - - let params = DidOpenTextDocumentParams { - text_document: TextDocumentItem { - uri: self.uri(name).into(), - version: 0, - language_id: language_id.to_owned(), - text, - }, - }; - self.server.execute(|svr| svr.did_open(params)).await; - } -} - -pub mod capabilities { - use lsp_types::*; - - pub static CLIENT_FULL_CAPABILITIES: ClientCapabilities = ClientCapabilities { - workspace: Some(WorkspaceClientCapabilities { - configuration: Some(true), - did_change_watched_files: None, - workspace_folders: None, - apply_edit: None, - execute_command: None, - symbol: None, - workspace_edit: None, - did_change_configuration: None, - }), - text_document: Some(TextDocumentClientCapabilities { - synchronization: None, - completion: None, - hover: None, - signature_help: None, - references: None, - document_highlight: None, - document_symbol: Some(DocumentSymbolCapability { - dynamic_registration: None, - hierarchical_document_symbol_support: Some(true), - symbol_kind: None, - }), - formatting: None, - range_formatting: None, - on_type_formatting: None, - declaration: None, - definition: Some(GotoCapability { - dynamic_registration: None, - link_support: Some(true), - }), - type_definition: None, - implementation: None, - code_action: None, - code_lens: None, - document_link: None, - color_provider: None, - rename: None, - publish_diagnostics: None, - folding_range: None, - }), - experimental: None, - window: Some(WindowClientCapabilities { - work_done_progress: Some(true), - }), - }; - - pub static CLIENT_NO_LINK_CAPABILITIES: ClientCapabilities = ClientCapabilities { - workspace: Some(WorkspaceClientCapabilities { - configuration: Some(true), - did_change_watched_files: None, - workspace_folders: None, - apply_edit: None, - execute_command: None, - symbol: None, - workspace_edit: None, - did_change_configuration: None, - }), - text_document: Some(TextDocumentClientCapabilities { - synchronization: None, - completion: None, - hover: None, - signature_help: None, - references: None, - document_highlight: None, - document_symbol: None, - formatting: None, - range_formatting: None, - on_type_formatting: None, - declaration: None, - definition: Some(GotoCapability { - dynamic_registration: None, - link_support: Some(false), - }), - type_definition: None, - implementation: None, - code_action: None, - code_lens: None, - document_link: None, - color_provider: None, - rename: None, - publish_diagnostics: None, - folding_range: None, - }), - experimental: None, - window: Some(WindowClientCapabilities { - work_done_progress: Some(true), - }), - }; -} - -pub mod completion { - use super::*; - - pub async fn run_list( - scenario_short_name: &'static str, - file: &'static str, - line: u64, - character: u64, - ) -> (Scenario, Vec<CompletionItem>) { - let scenario_name = format!("completion/{}", scenario_short_name); - let scenario = Scenario::new(&scenario_name, Arc::new(Box::new(tex::Unknown))); - scenario.open(file).await; - scenario - .initialize(&capabilities::CLIENT_FULL_CAPABILITIES) - .await; - - let params = CompletionParams { - text_document_position: TextDocumentPositionParams { - text_document: TextDocumentIdentifier::new(scenario.uri(file).into()), - position: Position::new(line, character), - }, - context: None, - }; - - let items = scenario - .server - .execute_async(|svr| svr.completion(params)) - .await - .unwrap() - .items; - - (scenario, items) - } - - pub async fn run_empty( - scenario_short_name: &'static str, - file: &'static str, - line: u64, - character: u64, - ) { - assert!(run_list(scenario_short_name, file, line, character) - .await - .1 - .is_empty()); - } - - pub async fn run_item( - scenario_short_name: &'static str, - file: &'static str, - line: u64, - character: u64, - item_name: &'static str, - ) -> CompletionItem { - let (scenario, items) = run_list(scenario_short_name, file, line, character).await; - - let item = items - .into_iter() - .find(|item| item.label == item_name) - .unwrap(); - - scenario - .server - .execute_async(|svr| svr.completion_resolve(item)) - .await - .unwrap() - } - - pub mod verify { - use lsp_types::*; - use texlab::range::RangeExt; - - pub fn text_edit( - item: &CompletionItem, - start_line: u64, - start_character: u64, - end_line: u64, - end_character: u64, - text: &str, - ) { - assert_eq!( - item.text_edit, - Some(TextEdit::new( - Range::new_simple(start_line, start_character, end_line, end_character), - text.into() - )) - ); - } - - pub fn detail(item: &CompletionItem, detail: &str) { - assert_eq!(item.detail.as_ref().unwrap(), detail); - } - - pub fn labels(items: &[CompletionItem], expected_labels: Vec<&'static str>) { - let mut actual_labels: Vec<&str> = - items.iter().map(|item| item.label.as_ref()).collect(); - actual_labels.sort(); - assert_eq!(actual_labels, expected_labels); - } - } -} - -pub mod definition { - use super::capabilities::*; - use super::*; - use texlab::definition::DefinitionResponse; - - pub async fn run( - scenario_short_name: &'static str, - file: &'static str, - line: u64, - character: u64, - capabilities: &ClientCapabilities, - ) -> (Scenario, DefinitionResponse) { - let scenario_name = format!("definition/{}", scenario_short_name); - let scenario = Scenario::new(&scenario_name, Arc::new(Box::new(tex::Unknown))); - scenario.initialize(capabilities).await; - scenario.open(file).await; - - let params = TextDocumentPositionParams { - text_document: TextDocumentIdentifier::new(scenario.uri(file).into()), - position: Position::new(line, character), - }; - - let response = scenario - .server - .execute_async(|svr| svr.definition(params)) - .await - .unwrap(); - - (scenario, response) - } - - pub async fn run_link( - scenario_short_name: &'static str, - file: &'static str, - line: u64, - character: u64, - ) -> (Scenario, Vec<LocationLink>) { - let (scenario, response) = run( - scenario_short_name, - file, - line, - character, - &CLIENT_FULL_CAPABILITIES, - ) - .await; - match response { - DefinitionResponse::LocationLinks(links) => (scenario, links), - DefinitionResponse::Locations(_) => unreachable!(), - } - } - - pub async fn run_location( - scenario_short_name: &'static str, - file: &'static str, - line: u64, - character: u64, - ) -> (Scenario, Vec<Location>) { - let (scenario, response) = run( - scenario_short_name, - file, - line, - character, - &CLIENT_NO_LINK_CAPABILITIES, - ) - .await; - match response { - DefinitionResponse::LocationLinks(_) => unreachable!(), - DefinitionResponse::Locations(locations) => (scenario, locations), - } - } - - pub mod verify { - use super::*; - use texlab::range::RangeExt; - - pub fn origin_selection_range( - link: &LocationLink, - start_line: u64, - start_character: u64, - end_line: u64, - end_character: u64, - ) { - assert_eq!( - link.origin_selection_range, - Some(Range::new_simple( - start_line, - start_character, - end_line, - end_character - )) - ); - } - } -} - -pub mod folding { - use super::*; - use std::cmp::Reverse; - - pub async fn run(file: &'static str) -> Vec<FoldingRange> { - let scenario = Scenario::new("folding", Arc::new(Box::new(tex::Unknown))); - scenario - .initialize(&capabilities::CLIENT_FULL_CAPABILITIES) - .await; - scenario.open(file).await; - let params = FoldingRangeParams { - text_document: TextDocumentIdentifier::new(scenario.uri(file).into()), - }; - - let mut foldings = scenario - .server - .execute_async(|svr| svr.folding_range(params)) - .await - .unwrap(); - - foldings.sort_by_key(|folding| { - let start = Position::new(folding.start_line, folding.start_character.unwrap()); - let end = Position::new(folding.end_line, folding.end_character.unwrap()); - (start, Reverse(end)) - }); - foldings - } -} - -pub mod formatting { - use super::*; - use texlab::formatting::bibtex::BibtexFormattingOptions; - - pub async fn run_bibtex( - file: &'static str, - options: Option<BibtexFormattingOptions>, - ) -> (Scenario, Vec<TextEdit>) { - let scenario = Scenario::new("formatting/bibtex", Arc::new(Box::new(tex::Unknown))); - scenario - .initialize(&capabilities::CLIENT_FULL_CAPABILITIES) - .await; - scenario.open(file).await; - { - scenario.client.options.lock().await.bibtex_formatting = options; - } - - let params = DocumentFormattingParams { - text_document: TextDocumentIdentifier::new(scenario.uri(file).into()), - options: FormattingOptions { - tab_size: 4, - insert_spaces: true, - properties: HashMap::new(), - }, - }; - - let edits = scenario - .server - .execute_async(|svr| svr.formatting(params)) - .await - .unwrap(); - (scenario, edits) - } -} - -pub mod hover { - use super::*; - - pub async fn run( - scenario_short_name: &'static str, - file: &'static str, - line: u64, - character: u64, - ) -> Option<HoverContents> { - let scenario_name = format!("hover/{}", scenario_short_name); - let scenario = Scenario::new(&scenario_name, Arc::new(Box::new(tex::Unknown))); - scenario - .initialize(&capabilities::CLIENT_FULL_CAPABILITIES) - .await; - scenario.open(file).await; - let identifier = TextDocumentIdentifier::new(scenario.uri(file).into()); - let params = TextDocumentPositionParams::new(identifier, Position::new(line, character)); - scenario - .server - .execute_async(|svr| svr.hover(params)) - .await - .unwrap() - .map(|hover| hover.contents) - } -} - -pub mod symbol { - use super::*; - use texlab::symbol::SymbolResponse; - - pub async fn run_hierarchical(file: &'static str) -> Vec<DocumentSymbol> { - let scenario = Scenario::new("symbol/hierarchical", Arc::new(Box::new(tex::Unknown))); - scenario - .initialize(&capabilities::CLIENT_FULL_CAPABILITIES) - .await; - scenario.open(file).await; - let params = DocumentSymbolParams { - text_document: TextDocumentIdentifier::new(scenario.uri(file).into()), - }; - - let response = scenario - .server - .execute_async(|svr| svr.document_symbol(params)) - .await - .unwrap(); - - match response { - SymbolResponse::Hierarchical(symbols) => symbols, - SymbolResponse::Flat(_) => unreachable!(), - } - } - - pub async fn run_workspace(query: &'static str) -> (Scenario, Vec<SymbolInformation>) { - let scenario = Scenario::new("symbol/workspace", Arc::new(Box::new(tex::Unknown))); - scenario - .initialize(&capabilities::CLIENT_FULL_CAPABILITIES) - .await; - scenario.open("foo.tex").await; - scenario.open("bar.bib").await; - let params = WorkspaceSymbolParams { - query: query.into(), - }; - let symbols = scenario - .server - .execute_async(|svr| svr.workspace_symbol(params)) - .await - .unwrap(); - - (scenario, symbols) - } - - pub mod verify { - use super::*; - use texlab::range::RangeExt; - - pub fn symbol( - symbol: &DocumentSymbol, - name: &str, - detail: Option<&str>, - selection_range: Range, - range: Range, - ) { - assert_eq!(symbol.name, name); - assert_eq!(symbol.detail.as_ref().map(AsRef::as_ref), detail); - assert_eq!(symbol.selection_range, selection_range); - assert_eq!(symbol.range, range); - } - - pub fn symbol_info( - symbol: &SymbolInformation, - scenario: &Scenario, - file: &str, - name: &str, - start_line: u64, - start_character: u64, - end_line: u64, - end_character: u64, - ) { - assert_eq!(symbol.name, name); - let range = Range::new_simple(start_line, start_character, end_line, end_character); - assert_eq!( - symbol.location, - Location::new(scenario.uri(file).into(), range) - ); - } - } -} diff --git a/support/texlab/tests/test_completion_bibtex_command.rs b/support/texlab/tests/test_completion_bibtex_command.rs deleted file mode 100644 index 1d741d6976..0000000000 --- a/support/texlab/tests/test_completion_bibtex_command.rs +++ /dev/null @@ -1,19 +0,0 @@ -pub mod support; - -use support::completion::*; - -const SCENARIO: &str = "bibtex/command"; - -#[tokio::test] -async fn incomplete_entry() { - let item = run_item(SCENARIO, "foo.bib", 1, 15, "LaTeX").await; - verify::text_edit(&item, 1, 15, 1, 18, "LaTeX"); - verify::detail(&item, "built-in"); -} - -#[tokio::test] -async fn complete_entry() { - let item = run_item(SCENARIO, "foo.bib", 5, 15, "LaTeX").await; - verify::text_edit(&item, 5, 15, 5, 18, "LaTeX"); - verify::detail(&item, "built-in"); -} diff --git a/support/texlab/tests/test_completion_bibtex_field.rs b/support/texlab/tests/test_completion_bibtex_field.rs deleted file mode 100644 index 766bcd7019..0000000000 --- a/support/texlab/tests/test_completion_bibtex_field.rs +++ /dev/null @@ -1,19 +0,0 @@ -pub mod support; - -use support::completion::*; - -const SCENARIO: &str = "bibtex/field"; - -#[tokio::test] -async fn incomplete_entry() { - let item = run_item(SCENARIO, "foo.bib", 1, 6, "title").await; - assert!(item.documentation.is_some()); - verify::text_edit(&item, 1, 4, 1, 8, "title"); -} - -#[tokio::test] -async fn complete_entry() { - let item = run_item(SCENARIO, "foo.bib", 4, 5, "title").await; - assert!(item.documentation.is_some()); - verify::text_edit(&item, 4, 4, 4, 9, "title"); -} diff --git a/support/texlab/tests/test_completion_bibtex_type.rs b/support/texlab/tests/test_completion_bibtex_type.rs deleted file mode 100644 index 5d56e3c178..0000000000 --- a/support/texlab/tests/test_completion_bibtex_type.rs +++ /dev/null @@ -1,26 +0,0 @@ -pub mod support; - -use support::completion::*; - -const SCENARIO: &str = "bibtex/type"; - -#[tokio::test] -async fn empty_type() { - let item = run_item(SCENARIO, "foo.bib", 0, 1, "article").await; - assert!(item.documentation.is_some()); - verify::text_edit(&item, 0, 1, 0, 1, "article"); -} - -#[tokio::test] -async fn incomplete_type() { - let item = run_item(SCENARIO, "foo.bib", 1, 2, "article").await; - assert!(item.documentation.is_some()); - verify::text_edit(&item, 1, 1, 1, 4, "article"); -} - -#[tokio::test] -async fn complete_type() { - let item = run_item(SCENARIO, "foo.bib", 2, 8, "article").await; - assert!(item.documentation.is_some()); - verify::text_edit(&item, 2, 1, 2, 8, "article"); -} diff --git a/support/texlab/tests/test_completion_bibtex_word.rs b/support/texlab/tests/test_completion_bibtex_word.rs deleted file mode 100644 index 3f757047a3..0000000000 --- a/support/texlab/tests/test_completion_bibtex_word.rs +++ /dev/null @@ -1,20 +0,0 @@ -pub mod support; - -use support::completion::*; - -const SCENARIO: &str = "bibtex/word"; - -#[tokio::test] -async fn no_text() { - run_empty(SCENARIO, "foo.bib", 0, 0).await; -} - -#[tokio::test] -async fn before_brace_entry() { - run_empty(SCENARIO, "foo.bib", 2, 14).await; -} - -#[tokio::test] -async fn before_brace_comment() { - run_empty(SCENARIO, "foo.bib", 6, 14).await; -} diff --git a/support/texlab/tests/test_completion_latex_citation.rs b/support/texlab/tests/test_completion_latex_citation.rs deleted file mode 100644 index 07ecd6690f..0000000000 --- a/support/texlab/tests/test_completion_latex_citation.rs +++ /dev/null @@ -1,26 +0,0 @@ -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); -} diff --git a/support/texlab/tests/test_completion_latex_color.rs b/support/texlab/tests/test_completion_latex_color.rs deleted file mode 100644 index 43c956ef78..0000000000 --- a/support/texlab/tests/test_completion_latex_color.rs +++ /dev/null @@ -1,23 +0,0 @@ -pub mod support; - -use support::completion::*; - -const SCENARIO: &str = "latex/color"; - -#[tokio::test] -async fn name() { - let item = run_item(SCENARIO, "foo.tex", 0, 9, "red").await; - verify::text_edit(&item, 0, 7, 0, 9, "red"); -} - -#[tokio::test] -async fn model_definecolor() { - let item = run_item(SCENARIO, "foo.tex", 1, 18, "rgb").await; - verify::text_edit(&item, 1, 18, 1, 18, "rgb"); -} - -#[tokio::test] -async fn model_definecolorset() { - let item = run_item(SCENARIO, "foo.tex", 2, 17, "RGB").await; - verify::text_edit(&item, 2, 16, 2, 17, "RGB"); -} diff --git a/support/texlab/tests/test_completion_latex_component.rs b/support/texlab/tests/test_completion_latex_component.rs deleted file mode 100644 index 6671fa9c07..0000000000 --- a/support/texlab/tests/test_completion_latex_component.rs +++ /dev/null @@ -1,68 +0,0 @@ -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"); -} diff --git a/support/texlab/tests/test_completion_latex_include.rs b/support/texlab/tests/test_completion_latex_include.rs deleted file mode 100644 index b657804317..0000000000 --- a/support/texlab/tests/test_completion_latex_include.rs +++ /dev/null @@ -1,29 +0,0 @@ -pub mod support; - -use support::completion::*; - -const SCENARIO: &str = "latex/include"; - -#[tokio::test] -async fn include_root() { - let (_, items) = run_list(SCENARIO, "foo.tex", 2, 9).await; - verify::labels(&items, vec!["bar", "foo", "qux"]); -} - -#[tokio::test] -async fn input_root() { - let (_, items) = run_list(SCENARIO, "foo.tex", 3, 7).await; - verify::labels(&items, vec!["bar.tex", "foo.tex", "qux"]); -} - -#[tokio::test] -async fn input_subdirectory() { - let (_, items) = run_list(SCENARIO, "foo.tex", 4, 11).await; - verify::labels(&items, vec!["baz.tex"]); -} - -#[tokio::test] -async fn bibliography() { - let (_, items) = run_list(SCENARIO, "foo.tex", 5, 16).await; - verify::labels(&items, vec!["bibliography.bib", "qux"]); -} diff --git a/support/texlab/tests/test_completion_latex_label.rs b/support/texlab/tests/test_completion_latex_label.rs deleted file mode 100644 index 78f302672e..0000000000 --- a/support/texlab/tests/test_completion_latex_label.rs +++ /dev/null @@ -1,34 +0,0 @@ -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"]); -} diff --git a/support/texlab/tests/test_completion_latex_preselect.rs b/support/texlab/tests/test_completion_latex_preselect.rs deleted file mode 100644 index 8c56a8ec9f..0000000000 --- a/support/texlab/tests/test_completion_latex_preselect.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub mod support; - -use support::completion::*; - -const SCENARIO: &str = "latex/preselect"; - -#[tokio::test] -async fn environment() { - let item = run_item(SCENARIO, "foo.tex", 2, 5, "document").await; - assert_eq!(item.preselect, Some(true)); -} diff --git a/support/texlab/tests/test_completion_latex_theorem.rs b/support/texlab/tests/test_completion_latex_theorem.rs deleted file mode 100644 index 25cb419c84..0000000000 --- a/support/texlab/tests/test_completion_latex_theorem.rs +++ /dev/null @@ -1,12 +0,0 @@ -pub mod support; - -use support::completion::*; - -const SCENARIO: &str = "latex/theorem"; - -#[tokio::test] -async fn newtheorem() { - let item = run_item(SCENARIO, "foo.tex", 4, 7, "foo").await; - verify::text_edit(&item, 4, 7, 4, 8, "foo"); - verify::detail(&item, "user-defined"); -} diff --git a/support/texlab/tests/test_completion_latex_tikz.rs b/support/texlab/tests/test_completion_latex_tikz.rs deleted file mode 100644 index d3558fb118..0000000000 --- a/support/texlab/tests/test_completion_latex_tikz.rs +++ /dev/null @@ -1,21 +0,0 @@ -// let item = run_completion_item("latex/tikz", "foo.tex", 1, 15, "arrows").await; -// verify_text_edit(&item, 1, 15, 1, 15, "arrows"); -// let item = run_completion_item("latex/tikz", "foo.tex", 2, 16, "arrows").await; -// verify_text_edit(&item, 2, 16, 2, 16, "arrows"); -pub mod support; - -use support::completion::*; - -const SCENARIO: &str = "latex/tikz"; - -#[tokio::test] -async fn pgf_library() { - let item = run_item(SCENARIO, "foo.tex", 1, 15, "arrows").await; - verify::text_edit(&item, 1, 15, 1, 15, "arrows"); -} - -#[tokio::test] -async fn tikz_library() { - let item = run_item(SCENARIO, "foo.tex", 2, 16, "arrows").await; - verify::text_edit(&item, 2, 16, 2, 16, "arrows"); -} diff --git a/support/texlab/tests/test_completion_latex_user.rs b/support/texlab/tests/test_completion_latex_user.rs deleted file mode 100644 index d17a5c3f6a..0000000000 --- a/support/texlab/tests/test_completion_latex_user.rs +++ /dev/null @@ -1,19 +0,0 @@ -pub mod support; - -use support::completion::*; - -const SCENARIO: &str = "latex/user"; - -#[tokio::test] -async fn command() { - let item = run_item(SCENARIO, "foo.tex", 1, 3, "foo").await; - verify::text_edit(&item, 1, 1, 1, 3, "foo"); - verify::detail(&item, "user-defined"); -} - -#[tokio::test] -async fn environment() { - let item = run_item(SCENARIO, "foo.tex", 4, 7, "foo").await; - verify::text_edit(&item, 4, 7, 4, 9, "foo"); - verify::detail(&item, "user-defined"); -} diff --git a/support/texlab/tests/test_definition_bibtex_string.rs b/support/texlab/tests/test_definition_bibtex_string.rs deleted file mode 100644 index 99382de534..0000000000 --- a/support/texlab/tests/test_definition_bibtex_string.rs +++ /dev/null @@ -1,18 +0,0 @@ -pub mod support; - -use lsp_types::Range; -use support::definition::*; -use texlab::range::RangeExt; - -const SCENARIO: &str = "bibtex/string"; - -#[tokio::test] -async fn link() { - let (scenario, mut links) = run_link(SCENARIO, "foo.bib", 5, 14).await; - assert_eq!(links.len(), 1); - let link = links.pop().unwrap(); - verify::origin_selection_range(&link, 5, 13, 5, 16); - assert_eq!(link.target_uri, scenario.uri("foo.bib").into()); - assert_eq!(link.target_range, Range::new_simple(2, 0, 2, 20)); - assert_eq!(link.target_selection_range, Range::new_simple(2, 8, 2, 11)); -} diff --git a/support/texlab/tests/test_definition_latex_citation.rs b/support/texlab/tests/test_definition_latex_citation.rs deleted file mode 100644 index 20c39dfe9d..0000000000 --- a/support/texlab/tests/test_definition_latex_citation.rs +++ /dev/null @@ -1,27 +0,0 @@ -pub mod support; - -use lsp_types::Range; -use support::definition::*; -use texlab::range::RangeExt; - -const SCENARIO: &str = "latex/citation"; - -#[tokio::test] -async fn link() { - let (scenario, mut links) = run_link(SCENARIO, "foo.tex", 1, 7).await; - assert_eq!(links.len(), 1); - let link = links.pop().unwrap(); - verify::origin_selection_range(&link, 1, 6, 1, 9); - assert_eq!(link.target_uri, scenario.uri("bar.bib").into()); - assert_eq!(link.target_range, Range::new_simple(2, 0, 2, 14)); - assert_eq!(link.target_selection_range, Range::new_simple(2, 9, 2, 12)); -} - -#[tokio::test] -async fn location() { - let (scenario, mut locations) = run_location(SCENARIO, "foo.tex", 1, 7).await; - assert_eq!(locations.len(), 1); - let location = locations.pop().unwrap(); - assert_eq!(location.uri, scenario.uri("bar.bib").into()); - assert_eq!(location.range, Range::new_simple(2, 9, 2, 12)); -} diff --git a/support/texlab/tests/test_definition_latex_command.rs b/support/texlab/tests/test_definition_latex_command.rs deleted file mode 100644 index eba32f9a17..0000000000 --- a/support/texlab/tests/test_definition_latex_command.rs +++ /dev/null @@ -1,18 +0,0 @@ -pub mod support; - -use lsp_types::Range; -use support::definition::*; -use texlab::range::RangeExt; - -const SCENARIO: &str = "latex/command"; - -#[tokio::test] -async fn link() { - let (scenario, mut links) = run_link(SCENARIO, "foo.tex", 2, 2).await; - assert_eq!(links.len(), 1); - let link = links.pop().unwrap(); - verify::origin_selection_range(&link, 2, 0, 2, 4); - assert_eq!(link.target_uri, scenario.uri("foo.tex").into()); - assert_eq!(link.target_range, Range::new_simple(0, 0, 0, 22)); - assert_eq!(link.target_selection_range, Range::new_simple(0, 0, 0, 22)); -} diff --git a/support/texlab/tests/test_definition_latex_label.rs b/support/texlab/tests/test_definition_latex_label.rs deleted file mode 100644 index 3979b2cabe..0000000000 --- a/support/texlab/tests/test_definition_latex_label.rs +++ /dev/null @@ -1,73 +0,0 @@ -pub mod support; - -use lsp_types::Range; -use support::definition::*; -use texlab::range::RangeExt; - -const SCENARIO: &str = "latex/label"; - -#[tokio::test] -async fn default_link() { - let (scenario, mut links) = run_link(SCENARIO, "default.tex", 1, 7).await; - assert_eq!(links.len(), 1); - let link = links.pop().unwrap(); - verify::origin_selection_range(&link, 1, 5, 1, 8); - assert_eq!(link.target_uri, scenario.uri("default.tex").into()); - assert_eq!(link.target_range, Range::new_simple(0, 0, 0, 11)); - assert_eq!(link.target_selection_range, Range::new_simple(0, 0, 0, 11)); -} - -#[tokio::test] -async fn equation_link() { - let (scenario, mut links) = run_link(SCENARIO, "equation.tex", 5, 8).await; - assert_eq!(links.len(), 1); - let link = links.pop().unwrap(); - verify::origin_selection_range(&link, 5, 5, 5, 11); - assert_eq!(link.target_uri, scenario.uri("equation.tex").into()); - assert_eq!(link.target_range, Range::new_simple(0, 0, 3, 14)); - assert_eq!(link.target_selection_range, Range::new_simple(1, 0, 1, 14)); -} - -#[tokio::test] -async fn float_link() { - let (scenario, mut links) = run_link(SCENARIO, "float.tex", 6, 6).await; - assert_eq!(links.len(), 1); - let link = links.pop().unwrap(); - verify::origin_selection_range(&link, 6, 5, 6, 8); - assert_eq!(link.target_uri, scenario.uri("float.tex").into()); - assert_eq!(link.target_range, Range::new_simple(0, 0, 4, 12)); - assert_eq!(link.target_selection_range, Range::new_simple(3, 0, 3, 11)); -} - -#[tokio::test] -async fn item_link() { - let (scenario, mut links) = run_link(SCENARIO, "item.tex", 6, 6).await; - assert_eq!(links.len(), 1); - let link = links.pop().unwrap(); - verify::origin_selection_range(&link, 6, 5, 6, 8); - assert_eq!(link.target_uri, scenario.uri("item.tex").into()); - assert_eq!(link.target_range, Range::new_simple(0, 0, 4, 15)); - assert_eq!(link.target_selection_range, Range::new_simple(2, 9, 2, 20)); -} - -#[tokio::test] -async fn section_link() { - let (scenario, mut links) = run_link(SCENARIO, "section.tex", 6, 6).await; - assert_eq!(links.len(), 1); - let link = links.pop().unwrap(); - verify::origin_selection_range(&link, 6, 5, 6, 12); - assert_eq!(link.target_uri, scenario.uri("section.tex").into()); - assert_eq!(link.target_range, Range::new_simple(0, 0, 3, 0)); - assert_eq!(link.target_selection_range, Range::new_simple(1, 0, 1, 15)); -} - -#[tokio::test] -async fn theorem_link() { - let (scenario, mut links) = run_link(SCENARIO, "theorem.tex", 8, 7).await; - assert_eq!(links.len(), 1); - let link = links.pop().unwrap(); - verify::origin_selection_range(&link, 8, 5, 8, 12); - assert_eq!(link.target_uri, scenario.uri("theorem.tex").into()); - assert_eq!(link.target_range, Range::new_simple(3, 0, 6, 11)); - assert_eq!(link.target_selection_range, Range::new_simple(4, 0, 4, 15)); -} diff --git a/support/texlab/tests/test_definition_latex_math_operator.rs b/support/texlab/tests/test_definition_latex_math_operator.rs deleted file mode 100644 index 7cea12261d..0000000000 --- a/support/texlab/tests/test_definition_latex_math_operator.rs +++ /dev/null @@ -1,18 +0,0 @@ -pub mod support; - -use lsp_types::Range; -use support::definition::*; -use texlab::range::RangeExt; - -const SCENARIO: &str = "latex/math_operator"; - -#[tokio::test] -async fn link() { - let (scenario, mut links) = run_link(SCENARIO, "foo.tex", 2, 2).await; - assert_eq!(links.len(), 1); - let link = links.pop().unwrap(); - verify::origin_selection_range(&link, 2, 0, 2, 4); - assert_eq!(link.target_uri, scenario.uri("foo.tex").into()); - assert_eq!(link.target_range, Range::new_simple(0, 0, 0, 31)); - assert_eq!(link.target_selection_range, Range::new_simple(0, 0, 0, 31)); -} diff --git a/support/texlab/tests/test_diagnostics_bibtex.rs b/support/texlab/tests/test_diagnostics_bibtex.rs deleted file mode 100644 index 8198e9c152..0000000000 --- a/support/texlab/tests/test_diagnostics_bibtex.rs +++ /dev/null @@ -1,36 +0,0 @@ -pub mod support; - -use lsp_types::*; -use std::sync::Arc; -use support::*; -use texlab::diagnostics::BibtexErrorCode; - -#[tokio::test] -async fn did_change_update() { - let scenario = Scenario::new("diagnostics/bibtex", Arc::new(Box::new(tex::Unknown))); - scenario.open("foo.bib").await; - { - let diagnostics_by_uri = scenario.client.diagnostics_by_uri.lock().await; - let diagnostics = &diagnostics_by_uri[&scenario.uri("foo.bib")]; - assert_eq!(diagnostics.len(), 1); - assert_eq!( - diagnostics[0].message, - BibtexErrorCode::MissingBeginBrace.message() - ); - assert_eq!(diagnostics[0].range.start.line, 0); - } - let params = DidChangeTextDocumentParams { - text_document: VersionedTextDocumentIdentifier::new(scenario.uri("foo.bib").into(), 0), - content_changes: vec![TextDocumentContentChangeEvent { - range: None, - range_length: None, - text: "@article{foo,}\n".into(), - }], - }; - scenario.server.execute(|svr| svr.did_change(params)).await; - { - let diagnostics_by_uri = scenario.client.diagnostics_by_uri.lock().await; - let diagnostics = &diagnostics_by_uri[&scenario.uri("foo.bib")]; - assert_eq!(diagnostics.len(), 0); - } -} diff --git a/support/texlab/tests/test_diagnostics_build.rs b/support/texlab/tests/test_diagnostics_build.rs deleted file mode 100644 index 9c953bee7a..0000000000 --- a/support/texlab/tests/test_diagnostics_build.rs +++ /dev/null @@ -1,25 +0,0 @@ -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()); - } -} diff --git a/support/texlab/tests/test_folding.rs b/support/texlab/tests/test_folding.rs deleted file mode 100644 index 0fafe553f0..0000000000 --- a/support/texlab/tests/test_folding.rs +++ /dev/null @@ -1,66 +0,0 @@ -pub mod support; - -use lsp_types::*; -use support::folding::*; - -#[tokio::test] -async fn bibtex() { - let foldings = run("bar.bib").await; - assert_eq!( - foldings, - vec![ - FoldingRange { - start_line: 0, - start_character: Some(0), - end_line: 0, - end_character: Some(23), - kind: Some(FoldingRangeKind::Region) - }, - FoldingRange { - start_line: 2, - start_character: Some(0), - end_line: 2, - end_character: Some(19), - kind: Some(FoldingRangeKind::Region) - }, - FoldingRange { - start_line: 4, - start_character: Some(0), - end_line: 23, - end_character: Some(0), - kind: Some(FoldingRangeKind::Region) - } - ] - ); -} - -#[tokio::test] -async fn latex() { - let foldings = run("foo.tex").await; - assert_eq!( - foldings, - vec![ - FoldingRange { - start_line: 4, - start_character: Some(16), - end_line: 12, - end_character: Some(0), - kind: Some(FoldingRangeKind::Region) - }, - FoldingRange { - start_line: 6, - start_character: Some(13), - end_line: 9, - end_character: Some(0), - kind: Some(FoldingRangeKind::Region) - }, - FoldingRange { - start_line: 8, - start_character: Some(16), - end_line: 9, - end_character: Some(0), - kind: Some(FoldingRangeKind::Region) - }, - ] - ); -} diff --git a/support/texlab/tests/test_formatting_bibtex.rs b/support/texlab/tests/test_formatting_bibtex.rs deleted file mode 100644 index 541b519d58..0000000000 --- a/support/texlab/tests/test_formatting_bibtex.rs +++ /dev/null @@ -1,34 +0,0 @@ -pub mod support; - -use lsp_types::*; -use support::formatting::*; -use texlab::formatting::bibtex::BibtexFormattingOptions; -use texlab::range::RangeExt; - -#[tokio::test] -async fn default_settings() { - let (scenario, edits) = run_bibtex("default/unformatted.bib", None).await; - assert_eq!(edits.len(), 1); - assert_eq!( - edits[0].new_text, - scenario.read("default/formatted.bib").await - ); - assert_eq!(edits[0].range, Range::new_simple(0, 0, 0, 52)); -} - -#[tokio::test] -async fn infinite_line_length() { - let (scenario, edits) = run_bibtex( - "infinite_line_length/unformatted.bib", - Some(BibtexFormattingOptions { - line_length: Some(0), - }), - ) - .await; - assert_eq!(edits.len(), 1); - assert_eq!( - edits[0].new_text, - scenario.read("infinite_line_length/formatted.bib").await - ); - assert_eq!(edits[0].range, Range::new_simple(0, 0, 0, 149)); -} diff --git a/support/texlab/tests/test_hover_bibtex_field.rs b/support/texlab/tests/test_hover_bibtex_field.rs deleted file mode 100644 index 06f12349ac..0000000000 --- a/support/texlab/tests/test_hover_bibtex_field.rs +++ /dev/null @@ -1,28 +0,0 @@ -pub mod support; - -use lsp_types::*; -use support::hover::*; -use texlab::syntax::LANGUAGE_DATA; - -const SCENARIO: &str = "bibtex/field"; - -#[tokio::test] -async fn known() { - let contents = run(SCENARIO, "foo.bib", 1, 4).await.unwrap(); - assert_eq!( - contents, - HoverContents::Markup(MarkupContent { - kind: MarkupKind::Markdown, - value: LANGUAGE_DATA - .field_documentation("author") - .unwrap() - .to_owned() - }) - ); -} - -#[tokio::test] -async fn unknown() { - let contents = run(SCENARIO, "foo.bib", 2, 5).await; - assert_eq!(contents, None); -} diff --git a/support/texlab/tests/test_hover_bibtex_string_reference.rs b/support/texlab/tests/test_hover_bibtex_string_reference.rs deleted file mode 100644 index d67f028990..0000000000 --- a/support/texlab/tests/test_hover_bibtex_string_reference.rs +++ /dev/null @@ -1,24 +0,0 @@ -pub mod support; - -use lsp_types::*; -use support::hover::*; - -const SCENARIO: &str = "bibtex/string_reference"; - -#[tokio::test] -async fn valid() { - let contents = run(SCENARIO, "foo.bib", 3, 15).await.unwrap(); - assert_eq!( - contents, - HoverContents::Markup(MarkupContent { - kind: MarkupKind::PlainText, - value: "\"foo {bar} baz\"".into(), - }) - ); -} - -#[tokio::test] -async fn invalid() { - let contents = run(SCENARIO, "foo.bib", 3, 20).await; - assert_eq!(contents, None); -} diff --git a/support/texlab/tests/test_hover_bibtex_type.rs b/support/texlab/tests/test_hover_bibtex_type.rs deleted file mode 100644 index 23db7084d5..0000000000 --- a/support/texlab/tests/test_hover_bibtex_type.rs +++ /dev/null @@ -1,28 +0,0 @@ -pub mod support; - -use lsp_types::*; -use support::hover::*; -use texlab::syntax::LANGUAGE_DATA; - -const SCENARIO: &str = "bibtex/type"; - -#[tokio::test] -async fn known() { - let contents = run(SCENARIO, "foo.bib", 0, 5).await.unwrap(); - assert_eq!( - contents, - HoverContents::Markup(MarkupContent { - kind: MarkupKind::Markdown, - value: LANGUAGE_DATA - .entry_type_documentation("article") - .unwrap() - .to_owned() - }) - ); -} - -#[tokio::test] -async fn unknown() { - let contents = run(SCENARIO, "foo.bib", 2, 2).await; - assert_eq!(contents, None); -} diff --git a/support/texlab/tests/test_hover_latex_citation.rs b/support/texlab/tests/test_hover_latex_citation.rs deleted file mode 100644 index cbefafd27b..0000000000 --- a/support/texlab/tests/test_hover_latex_citation.rs +++ /dev/null @@ -1,24 +0,0 @@ -pub mod support; - -use lsp_types::*; -use support::hover::*; - -const SCENARIO: &str = "latex/citation"; - -#[tokio::test] -async fn valid() { - let contents = run(SCENARIO, "foo.tex", 2, 7).await.unwrap(); - assert_eq!( - contents, - HoverContents::Markup(MarkupContent { - kind: MarkupKind::Markdown, - value: "Bar, F. (2019). *Baz Qux*.".into() - }) - ); -} - -#[tokio::test] -async fn invalid() { - let contents = run(SCENARIO, "foo.bib", 3, 7).await; - assert_eq!(contents, None); -} diff --git a/support/texlab/tests/test_hover_latex_component.rs b/support/texlab/tests/test_hover_latex_component.rs deleted file mode 100644 index de5c9c8b6c..0000000000 --- a/support/texlab/tests/test_hover_latex_component.rs +++ /dev/null @@ -1,27 +0,0 @@ -pub mod support; - -use support::hover::*; - -const SCENARIO: &str = "latex/component"; - -#[tokio::test] -async fn class_known() { - run(SCENARIO, "foo.tex", 0, 18).await.unwrap(); -} - -#[tokio::test] -async fn class_unknown() { - let contents = run(SCENARIO, "foo.tex", 2, 16).await; - assert_eq!(contents, None); -} - -#[tokio::test] -async fn package_known() { - run(SCENARIO, "foo.tex", 1, 17).await.unwrap(); -} - -#[tokio::test] -async fn package_unknown() { - let contents = run(SCENARIO, "foo.tex", 3, 14).await; - assert_eq!(contents, None); -} diff --git a/support/texlab/tests/test_hover_latex_label.rs b/support/texlab/tests/test_hover_latex_label.rs deleted file mode 100644 index 94a96ad533..0000000000 --- a/support/texlab/tests/test_hover_latex_label.rs +++ /dev/null @@ -1,59 +0,0 @@ -pub mod support; - -use lsp_types::*; -use std::sync::Arc; -use support::capabilities::CLIENT_FULL_CAPABILITIES; -use support::*; -use tokio::fs; - -const SCENARIO: &str = "hover/latex/label"; - -#[tokio::test] -async fn reload_aux() { - let scenario = Scenario::new(SCENARIO, Arc::new(Box::new(tex::Unknown))); - scenario.initialize(&CLIENT_FULL_CAPABILITIES).await; - scenario.open("section.tex").await; - let position = Position::new(3, 10); - let identifier = TextDocumentIdentifier::new(scenario.uri("section.tex").into()); - let params = TextDocumentPositionParams::new(identifier, position); - let contents = scenario - .server - .execute_async(|svr| svr.hover(params.clone())) - .await - .unwrap() - .unwrap() - .contents; - - assert_eq!( - contents, - HoverContents::Markup(MarkupContent { - kind: MarkupKind::PlainText, - value: "Section (Foo)".into() - }) - ); - - let aux_path = scenario - .uri("section.tex") - .to_file_path() - .unwrap() - .with_extension("aux"); - fs::write(aux_path, "\\newlabel{sec:foo}{{1}{1}}") - .await - .unwrap(); - - let contents = scenario - .server - .execute_async(|svr| svr.hover(params)) - .await - .unwrap() - .unwrap() - .contents; - - assert_eq!( - contents, - HoverContents::Markup(MarkupContent { - kind: MarkupKind::PlainText, - value: "Section 1 (Foo)".into() - }) - ); -} diff --git a/support/texlab/tests/test_symbol_hierarchical.rs b/support/texlab/tests/test_symbol_hierarchical.rs deleted file mode 100644 index d83c0db455..0000000000 --- a/support/texlab/tests/test_symbol_hierarchical.rs +++ /dev/null @@ -1,167 +0,0 @@ -pub mod support; - -use lsp_types::Range; -use support::symbol::*; -use texlab::range::RangeExt; - -#[tokio::test] -async fn enumerate() { - let mut symbols = run_hierarchical("enumerate.tex").await; - assert_eq!(symbols.len(), 1); - verify::symbol( - &symbols[0], - "Enumerate", - None, - Range::new_simple(4, 0, 9, 15), - Range::new_simple(4, 0, 9, 15), - ); - - let children = symbols[0].children.take().unwrap(); - assert_eq!(children.len(), 4); - verify::symbol( - &children[0], - "1", - Some("it:foo"), - Range::new_simple(5, 9, 5, 23), - Range::new_simple(5, 4, 6, 4), - ); - verify::symbol( - &children[1], - "Item", - Some("it:bar"), - Range::new_simple(6, 9, 6, 23), - Range::new_simple(6, 4, 7, 4), - ); - verify::symbol( - &children[2], - "Baz", - None, - Range::new_simple(7, 4, 7, 14), - Range::new_simple(7, 4, 8, 4), - ); - verify::symbol( - &children[3], - "Qux", - Some("it:qux"), - Range::new_simple(8, 14, 8, 28), - Range::new_simple(8, 4, 9, 0), - ); -} - -#[tokio::test] -async fn equation() { - let symbols = run_hierarchical("equation.tex").await; - assert_eq!(symbols.len(), 3); - verify::symbol( - &symbols[0], - "Equation (1)", - Some("eq:foo"), - Range::new_simple(4, 16, 4, 30), - Range::new_simple(4, 0, 6, 14), - ); - verify::symbol( - &symbols[1], - "Equation", - Some("eq:bar"), - Range::new_simple(8, 16, 8, 30), - Range::new_simple(8, 0, 10, 14), - ); - verify::symbol( - &symbols[2], - "Equation", - None, - Range::new_simple(12, 0, 14, 14), - Range::new_simple(12, 0, 14, 14), - ); -} - -#[tokio::test] -async fn float() { - let symbols = run_hierarchical("float.tex").await; - assert_eq!(symbols.len(), 3); - verify::symbol( - &symbols[0], - "Figure 1: Foo", - Some("fig:foo"), - Range::new_simple(6, 17, 6, 32), - Range::new_simple(4, 0, 7, 12), - ); - verify::symbol( - &symbols[1], - "Figure: Bar", - Some("fig:bar"), - Range::new_simple(11, 17, 11, 32), - Range::new_simple(9, 0, 12, 12), - ); - verify::symbol( - &symbols[2], - "Figure: Baz", - None, - Range::new_simple(14, 0, 17, 12), - Range::new_simple(14, 0, 17, 12), - ); -} - -#[tokio::test] -async fn section() { - let mut symbols = run_hierarchical("section.tex").await; - assert_eq!(symbols.len(), 2); - verify::symbol( - &symbols[0], - "Foo", - None, - Range::new_simple(4, 0, 4, 13), - Range::new_simple(4, 0, 6, 0), - ); - verify::symbol( - &symbols[1], - "2 Bar", - Some("sec:bar"), - Range::new_simple(6, 0, 6, 13), - Range::new_simple(6, 0, 10, 0), - ); - - let children = symbols[1].children.take().unwrap(); - assert_eq!(children.len(), 1); - verify::symbol( - &children[0], - "Baz", - Some("sec:baz"), - Range::new_simple(8, 0, 8, 16), - Range::new_simple(8, 0, 10, 0), - ); -} - -#[tokio::test] -async fn theorem() { - let symbols = run_hierarchical("theorem.tex").await; - assert_eq!(symbols.len(), 4); - verify::symbol( - &symbols[0], - "Lemma 1 (Foo)", - Some("thm:foo"), - Range::new_simple(6, 18, 6, 33), - Range::new_simple(6, 0, 8, 11), - ); - verify::symbol( - &symbols[1], - "Lemma 2", - Some("thm:bar"), - Range::new_simple(10, 13, 10, 28), - Range::new_simple(10, 0, 12, 11), - ); - verify::symbol( - &symbols[2], - "Lemma", - Some("thm:baz"), - Range::new_simple(14, 13, 14, 28), - Range::new_simple(14, 0, 16, 11), - ); - verify::symbol( - &symbols[3], - "Lemma (Qux)", - None, - Range::new_simple(18, 0, 20, 11), - Range::new_simple(18, 0, 20, 11), - ); -} diff --git a/support/texlab/tests/test_symbol_workspace.rs b/support/texlab/tests/test_symbol_workspace.rs deleted file mode 100644 index cb6421c086..0000000000 --- a/support/texlab/tests/test_symbol_workspace.rs +++ /dev/null @@ -1,48 +0,0 @@ -pub mod support; - -use support::symbol::*; - -#[tokio::test] -async fn filter_type_section() { - let (scenario, symbols) = run_workspace("section").await; - assert_eq!(symbols.len(), 4); - verify::symbol_info(&symbols[0], &scenario, "foo.tex", "1 Foo", 07, 0, 13, 0); - verify::symbol_info(&symbols[1], &scenario, "foo.tex", "2 Bar", 13, 0, 21, 0); - verify::symbol_info(&symbols[2], &scenario, "foo.tex", "3 Baz", 21, 0, 29, 0); - verify::symbol_info(&symbols[3], &scenario, "foo.tex", "4 Qux", 29, 0, 37, 0); -} - -#[tokio::test] -async fn filter_type_figure() { - let (scenario, symbols) = run_workspace("figure").await; - assert_eq!(symbols.len(), 1); - let name = "Figure 1: Bar"; - verify::symbol_info(&symbols[0], &scenario, "foo.tex", name, 15, 0, 19, 12); -} - -#[tokio::test] -async fn filter_type_item() { - let (scenario, symbols) = run_workspace("item").await; - assert_eq!(symbols.len(), 3); - verify::symbol_info(&symbols[0], &scenario, "foo.tex", "1", 24, 4, 25, 4); - verify::symbol_info(&symbols[1], &scenario, "foo.tex", "2", 25, 4, 26, 4); - verify::symbol_info(&symbols[2], &scenario, "foo.tex", "3", 26, 4, 27, 0); -} - -#[tokio::test] -async fn filter_type_math() { - let (scenario, symbols) = run_workspace("math").await; - assert_eq!(symbols.len(), 2); - let name1 = "Equation (1)"; - let name2 = "Lemma 1 (Qux)"; - verify::symbol_info(&symbols[0], &scenario, "foo.tex", name1, 9, 0, 11, 14); - verify::symbol_info(&symbols[1], &scenario, "foo.tex", name2, 33, 0, 35, 11); -} - -#[tokio::test] -async fn filter_bibtex() { - let (scenario, symbols) = run_workspace("bibtex").await; - assert_eq!(symbols.len(), 2); - verify::symbol_info(&symbols[0], &scenario, "bar.bib", "foo", 0, 0, 0, 14); - verify::symbol_info(&symbols[1], &scenario, "bar.bib", "bar", 2, 0, 2, 20); -} |