feat: add test framework with coverage support (#1518)

* feat: test framework with coverage support

* feat: clean up

* fix: dangling else block

* feat: implement show set

* feat: implement show replace content

* feat: compare framework

* feat: preserve extension

* feat: exit 1 if failed testing

* docs: update docs about it

* docs: wording

* docs: wording

* docs: wording
This commit is contained in:
Myriad-Dreamin 2025-03-17 22:41:33 +08:00 committed by GitHub
parent c67b2020e5
commit b4e5f4ff62
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 1063 additions and 109 deletions

View file

@ -157,14 +157,13 @@ pub struct TaskCompileArgs {
#[arg(long = "pages", value_delimiter = ',')]
pub pages: Option<Vec<Pages>>,
/// One (or multiple comma-separated) PDF standards that Typst will enforce
/// conformance with.
#[arg(long = "pdf-standard", value_delimiter = ',')]
pub pdf_standard: Vec<PdfStandard>,
/// The argument to export to PDF.
#[clap(flatten)]
pub pdf: PdfExportArgs,
/// The PPI (pixels per inch) to use for PNG export.
#[arg(long = "ppi", default_value_t = 144.0)]
pub ppi: f32,
/// The argument to export to PNG.
#[clap(flatten)]
pub png: PngExportArgs,
/// The output format.
#[clap(skip)]
@ -215,12 +214,12 @@ impl TaskCompileArgs {
let config = match output_format {
OutputFormat::Pdf => ProjectTask::ExportPdf(ExportPdfTask {
export,
pdf_standards: self.pdf_standard.clone(),
pdf_standards: self.pdf.pdf_standard.clone(),
creation_timestamp: None,
}),
OutputFormat::Png => ProjectTask::ExportPng(ExportPngTask {
export,
ppi: self.ppi.try_into().unwrap(),
ppi: self.png.ppi.try_into().unwrap(),
fill: None,
}),
OutputFormat::Svg => ProjectTask::ExportSvg(ExportSvgTask { export }),
@ -234,3 +233,20 @@ impl TaskCompileArgs {
})
}
}
/// Declare arguments for exporting a document to PDF.
#[derive(Debug, Clone, clap::Parser)]
pub struct PdfExportArgs {
/// One (or multiple comma-separated) PDF standards that Typst will enforce
/// conformance with.
#[arg(long = "pdf-standard", value_delimiter = ',')]
pub pdf_standard: Vec<PdfStandard>,
}
/// Declare arguments for exporting a document to PNG.
#[derive(Debug, Clone, clap::Parser)]
pub struct PngExportArgs {
/// The PPI (pixels per inch) to use for PNG export.
#[arg(long = "ppi", default_value_t = 144.0)]
pub ppi: f32,
}

View file

@ -4,7 +4,8 @@ pub use tinymist_world as base;
pub use tinymist_world::args::*;
pub use tinymist_world::config::CompileFontOpts;
pub use tinymist_world::entry::*;
pub use tinymist_world::{font, package, vfs};
pub use tinymist_world::{font, package, system, vfs};
pub use tinymist_world::{
CompilerUniverse, CompilerWorld, EntryOpts, EntryState, RevisingUniverse, TaskInputs,
CompilerUniverse, CompilerWorld, DiagnosticFormat, EntryOpts, EntryState, RevisingUniverse,
TaskInputs,
};