test: hack to support compiling with --no-default-features

This commit is contained in:
Tobias Schmitz 2025-05-20 15:46:13 +02:00
parent 702fa063a1
commit 4cb04fd41c
No known key found for this signature in database

View File

@ -12,8 +12,6 @@ use typst_syntax::{
};
use unscanny::Scanner;
use crate::world::{read, system_path};
/// Collects all tests from all files.
///
/// Returns:
@ -390,9 +388,17 @@ impl<'a> Parser<'a> {
})
}
#[cfg(not(feature = "default"))]
fn parse_range_external(&mut self, _file: FileId) -> Option<Range<usize>> {
panic!("external file ranges are not expected when testing `typst_syntax`");
}
/// Parse a range in an external file, optionally abbreviated as just a position
/// if the range is empty.
#[cfg(feature = "default")]
fn parse_range_external(&mut self, file: FileId) -> Option<Range<usize>> {
use crate::world::{read, system_path};
let path = match system_path(file) {
Ok(path) => path,
Err(err) => {