From e8f7e37cf79efa5cca3f9dc7673452fe5ca72eec Mon Sep 17 00:00:00 2001 From: GloamXun Date: Tue, 27 Oct 2026 03:02:30 +0800 Subject: [PATCH] Pin the corpus page counts The corpus guard only checked that each document produced at least one page. It now asserts the exact counts (hello 1, boxes 1, compat 1, arXiv template 2) alongside the empty warnings array, so a layout regression that drops or adds a page fails the server test even when no warning is emitted. The status document's verification paragraph mentions the exact-count check. --- docs/ROUTE_D_STATUS.md | 6 +++--- tests/server.rs | 14 +++++++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/ROUTE_D_STATUS.md b/docs/ROUTE_D_STATUS.md index 413b548..560a2da 100755 --- a/docs/ROUTE_D_STATUS.md +++ b/docs/ROUTE_D_STATUS.md @@ -31,9 +31,9 @@ The oracle suite compiles fixtures with `pdflatex`, extracts word boxes with (saying so) when the TeX tools are absent. The server suite includes `corpus_documents_preview_without_warnings`, which previews `examples/hello.tex`, `examples/boxes.tex`, `examples/compat.tex` and -`fixtures/arxiv-template/template.tex` and asserts 200, at least one page and an -empty `warnings` array for each. A manual sweep of the same four documents -reports 0 warnings, 1/1/1/2 pages and under 1.5 s per preview. +`fixtures/arxiv-template/template.tex` and asserts 200, the expected page count +(1/1/1/2) and an empty `warnings` array for each. A manual sweep of the same four +documents reports 0 warnings and under 1.5 s per preview. ## Service defaults diff --git a/tests/server.rs b/tests/server.rs index 9c0b7e7..76ef0d8 100644 --- a/tests/server.rs +++ b/tests/server.rs @@ -2366,9 +2366,17 @@ fn corpus_documents_preview_without_warnings() { let value: Value = serde_json::from_slice(&response.body).expect("preview JSON"); let warnings = value["warnings"].as_array().cloned().unwrap_or_default(); assert!(warnings.is_empty(), "{relative}: {warnings:?}"); - assert!( - value["pageCount"].as_u64().unwrap_or(0) >= 1, - "{relative}: no pages" + let expected_pages = match relative { + "examples/hello.tex" => 1, + "examples/boxes.tex" => 1, + "examples/compat.tex" => 1, + "fixtures/arxiv-template/template.tex" => 2, + other => panic!("unexpected corpus document {other}"), + }; + assert_eq!( + value["pageCount"].as_u64(), + Some(expected_pages), + "{relative}: wrong page count" ); } }