summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-08-26 13:40:37 +0200
committerGitHub <noreply@github.com>2024-08-26 11:40:37 +0000
commitcf05284a0cdfb6bff62ecb60baf16bec9853abe4 (patch)
tree638bdf1e52277762deb84cdddec77023f90f481a
parent88325d7d019fd65c5177a92df4347ae9a287fc19 (diff)
Small improvements to the test runner (#4838)
-rw-r--r--tests/src/args.rs3
-rw-r--r--tests/src/logger.rs6
-rw-r--r--tests/src/run.rs7
3 files changed, 13 insertions, 3 deletions
diff --git a/tests/src/args.rs b/tests/src/args.rs
index ca0ee73c..b3441e90 100644
--- a/tests/src/args.rs
+++ b/tests/src/args.rs
@@ -46,6 +46,9 @@ pub struct CliArguments {
/// Displays the syntax tree.
#[arg(long)]
pub syntax: bool,
+ /// Displays only one line per test, hiding details about failures.
+ #[arg(short, long)]
+ pub compact: bool,
/// Prevents the terminal from being cleared of test names.
#[arg(short, long)]
pub verbose: bool,
diff --git a/tests/src/logger.rs b/tests/src/logger.rs
index b6b44848..a8ba43c6 100644
--- a/tests/src/logger.rs
+++ b/tests/src/logger.rs
@@ -70,8 +70,10 @@ impl<'a> Logger<'a> {
self.print(move |out| {
if !result.errors.is_empty() {
writeln!(out, "❌ {test}")?;
- for line in result.errors.lines() {
- writeln!(out, " {line}")?;
+ if !crate::ARGS.compact {
+ for line in result.errors.lines() {
+ writeln!(out, " {line}")?;
+ }
}
} else if crate::ARGS.verbose || !result.infos.is_empty() {
writeln!(out, "✅ {test}")?;
diff --git a/tests/src/run.rs b/tests/src/run.rs
index c65f5e38..f356f0d0 100644
--- a/tests/src/run.rs
+++ b/tests/src/run.rs
@@ -157,6 +157,10 @@ impl<'a> Runner<'a> {
};
let skippable = match document.pages.as_slice() {
+ [] => {
+ log!(self, "document has zero pages");
+ return;
+ }
[page] => skippable(page),
_ => false,
};
@@ -231,7 +235,7 @@ impl<'a> Runner<'a> {
std::fs::write(&ref_path, &ref_data).unwrap();
log!(
into: self.result.infos,
- "Updated reference image ({ref_path}, {})",
+ "updated reference image ({ref_path}, {})",
FileSize(ref_data.len()),
);
}
@@ -414,6 +418,7 @@ fn render_links(canvas: &mut sk::Pixmap, ts: sk::Transform, frame: &Frame) {
fn skippable(page: &Page) -> bool {
page.frame.width().approx_eq(Abs::pt(120.0))
&& page.frame.height().approx_eq(Abs::pt(20.0))
+ && page.fill.is_auto()
&& skippable_frame(&page.frame)
}