summaryrefslogtreecommitdiff
path: root/support/texlab/crates/texlab/tests/lsp/fixture.rs
diff options
context:
space:
mode:
Diffstat (limited to 'support/texlab/crates/texlab/tests/lsp/fixture.rs')
-rw-r--r--support/texlab/crates/texlab/tests/lsp/fixture.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/support/texlab/crates/texlab/tests/lsp/fixture.rs b/support/texlab/crates/texlab/tests/lsp/fixture.rs
index 02bed8c38a..a10105eb7f 100644
--- a/support/texlab/crates/texlab/tests/lsp/fixture.rs
+++ b/support/texlab/crates/texlab/tests/lsp/fixture.rs
@@ -26,14 +26,16 @@ impl Fixture {
let mut documents = Vec::new();
let mut start = 0;
- for end in input
- .match_indices("%!")
- .skip(1)
- .map(|(i, _)| i)
- .chain(std::iter::once(input.len()))
- {
- documents.push(Document::parse(&input[start..end]));
- start = end;
+ if !input.is_empty() {
+ for end in input
+ .match_indices("%!")
+ .skip(1)
+ .map(|(i, _)| i)
+ .chain(std::iter::once(input.len()))
+ {
+ documents.push(Document::parse(&input[start..end]));
+ start = end;
+ }
}
Self { documents }