summaryrefslogtreecommitdiff
path: root/support/texlab/src/features/folding.rs
diff options
context:
space:
mode:
Diffstat (limited to 'support/texlab/src/features/folding.rs')
-rw-r--r--support/texlab/src/features/folding.rs172
1 files changed, 0 insertions, 172 deletions
diff --git a/support/texlab/src/features/folding.rs b/support/texlab/src/features/folding.rs
index cd1a48f1a8..71fb0bee6f 100644
--- a/support/texlab/src/features/folding.rs
+++ b/support/texlab/src/features/folding.rs
@@ -55,175 +55,3 @@ fn create_range(range: Range) -> FoldingRange {
kind: Some(FoldingRangeKind::Region),
}
}
-
-#[cfg(test)]
-mod tests {
- use indoc::indoc;
-
- use crate::features::testing::FeatureTester;
-
- use super::*;
-
- #[test]
- fn test_empty_latex_document() {
- let request = FeatureTester::builder()
- .files(vec![("main.tex", "")])
- .main("main.tex")
- .build()
- .folding();
-
- let actual_foldings = find_foldings(request);
- assert!(actual_foldings.is_empty());
- }
-
- #[test]
- fn test_empty_bibtex_document() {
- let request = FeatureTester::builder()
- .files(vec![("main.bib", "")])
- .main("main.bib")
- .build()
- .folding();
-
- let actual_foldings = find_foldings(request);
- assert!(actual_foldings.is_empty());
- }
-
- #[test]
- fn test_latex() {
- let req = FeatureTester::builder()
- .files(vec![(
- "main.tex",
- indoc! {r#"
- \begin{document}
- \section{Foo}
- foo
- \subsection{Bar}
- bar
- \section{Baz}
- baz
- \section{Qux}
- \end{document}"# },
- )])
- .main("main.tex")
- .build()
- .folding();
-
- let mut actual_foldings = find_foldings(req);
- actual_foldings.sort_by_key(|folding| (folding.start_line, folding.start_character));
-
- assert_eq!(actual_foldings.len(), 5);
- assert_eq!(
- actual_foldings[0],
- FoldingRange {
- start_line: 0,
- start_character: Some(0),
- end_line: 8,
- end_character: Some(14),
- kind: Some(FoldingRangeKind::Region)
- }
- );
- assert_eq!(
- actual_foldings[1],
- FoldingRange {
- start_line: 1,
- start_character: Some(4),
- end_line: 4,
- end_character: Some(7),
- kind: Some(FoldingRangeKind::Region)
- }
- );
- assert_eq!(
- actual_foldings[2],
- FoldingRange {
- start_line: 3,
- start_character: Some(4),
- end_line: 4,
- end_character: Some(7),
- kind: Some(FoldingRangeKind::Region)
- }
- );
- assert_eq!(
- actual_foldings[3],
- FoldingRange {
- start_line: 5,
- start_character: Some(4),
- end_line: 6,
- end_character: Some(7),
- kind: Some(FoldingRangeKind::Region)
- }
- );
- assert_eq!(
- actual_foldings[4],
- FoldingRange {
- start_line: 7,
- start_character: Some(4),
- end_line: 7,
- end_character: Some(17),
- kind: Some(FoldingRangeKind::Region)
- }
- );
- }
-
- #[test]
- fn test_bibtex() {
- let request = FeatureTester::builder()
- .files(vec![(
- "main.bib",
- indoc! {r#"
- some junk
- here
-
- @article{foo,
- author = {bar},
- title = {baz}
- }
-
- @string{foo = "bar"}
-
- @comment{foo,
- author = {bar},
- title = {baz}
- }
-
- @preamble{"foo"}"# },
- )])
- .main("main.bib")
- .build()
- .folding();
-
- let mut actual_foldings = find_foldings(request);
- actual_foldings.sort_by_key(|folding| (folding.start_line, folding.start_character));
-
- assert_eq!(actual_foldings.len(), 3);
- assert_eq!(
- actual_foldings[0],
- FoldingRange {
- start_line: 3,
- start_character: Some(0),
- end_line: 6,
- end_character: Some(1),
- kind: Some(FoldingRangeKind::Region)
- }
- );
- assert_eq!(
- actual_foldings[1],
- FoldingRange {
- start_line: 8,
- start_character: Some(0),
- end_line: 8,
- end_character: Some(20),
- kind: Some(FoldingRangeKind::Region)
- }
- );
- assert_eq!(
- actual_foldings[2],
- FoldingRange {
- start_line: 15,
- start_character: Some(0),
- end_line: 15,
- end_character: Some(16),
- kind: Some(FoldingRangeKind::Region)
- }
- );
- }
-}