From 010483ed35d1285a4bba529bfd9b58c15f613bb7 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 17:48:17 -0800 Subject: [PATCH] linesweeper: test the sweep position after every edit and with slow-asserts `position_after_edits` checks the position of every segment on the sweep line, and of each contour continuation's old segment, after each edit. `scripts/test-pdf-backends.sh` runs the unit and regression tests a second time with the `slow-asserts` feature. --- scripts/test-pdf-backends.sh | 1 + vendor/linesweeper/README.craft.md | 4 +++- vendor/linesweeper/SOURCE.json | 2 +- vendor/linesweeper/src/sweep/sweep_line.rs | 6 ++++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/test-pdf-backends.sh b/scripts/test-pdf-backends.sh index 93e6603a47..a2dd185dec 100644 --- a/scripts/test-pdf-backends.sh +++ b/scripts/test-pdf-backends.sh @@ -19,4 +19,5 @@ cargo test --manifest-path "$test_root/hayro-syntax/Cargo.toml" --doc "${patches cargo test --manifest-path "$test_root/hayro-syntax/Cargo.toml" --lib --no-default-features --features std "${patches[@]}" cp -R "$root/vendor/linesweeper" "$test_root/linesweeper" cargo test --manifest-path "$test_root/linesweeper/Cargo.toml" --locked --lib --test regression +cargo test --manifest-path "$test_root/linesweeper/Cargo.toml" --locked --lib --test regression --features slow-asserts cargo test --manifest-path "$test_root/linesweeper/Cargo.toml" --locked --doc diff --git a/vendor/linesweeper/README.craft.md b/vendor/linesweeper/README.craft.md index 7a6791dd49..a7c3222c62 100644 --- a/vendor/linesweeper/README.craft.md +++ b/vendor/linesweeper/README.craft.md @@ -63,13 +63,15 @@ linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "" } ## Tests -`scripts/test-pdf-backends.sh` runs the package's unit, regression and doc tests. The `craft-prepress` +`scripts/test-pdf-backends.sh` runs the package's unit, regression and doc tests, and runs the unit +and regression tests again with the `slow-asserts` feature. The `craft-prepress` tests with the `flatten` feature run against this copy. `pdf.yml`'s path filter lists this directory, so a pull request that changes files here starts `pdf.yml`. No workflow runs clippy on this copy. Run the tests and clippy from this directory: ```sh cargo test --locked --lib --test regression +cargo test --locked --lib --test regression --features slow-asserts cargo test --locked --doc cargo clippy --locked --all-features --lib --test regression -- -D warnings cargo clippy --locked --all-features --lib --profile test -- -D warnings diff --git a/vendor/linesweeper/SOURCE.json b/vendor/linesweeper/SOURCE.json index c19028b304..760a11949e 100644 --- a/vendor/linesweeper/SOURCE.json +++ b/vendor/linesweeper/SOURCE.json @@ -72,7 +72,7 @@ { "path": "src/sweep/snapshots/linesweeper__sweep__sweep_line__tests__square.snap", "source_sha256": "b35c3e6a38d5ecdd8acf315ba0b0bd6485cd8b40193fdd76bd446bdfdb6eda77", "source_git_blob": null, "sha256": "b35c3e6a38d5ecdd8acf315ba0b0bd6485cd8b40193fdd76bd446bdfdb6eda77" }, { "path": "src/sweep/snapshots/linesweeper__sweep__sweep_line__tests__square_and_diamond.snap", "source_sha256": "3f01a76fb7ff4aef0fd55fd869602d4a2b69fff1bd65632f406b275b5d6af600", "source_git_blob": null, "sha256": "3f01a76fb7ff4aef0fd55fd869602d4a2b69fff1bd65632f406b275b5d6af600" }, { "path": "src/sweep/snapshots/linesweeper__sweep__sweep_line__tests__two_squares.snap", "source_sha256": "79e3c95e563a66c0ce244125470a106a18dfe29f276b732defd305406c873c7e", "source_git_blob": null, "sha256": "79e3c95e563a66c0ce244125470a106a18dfe29f276b732defd305406c873c7e" }, - { "path": "src/sweep/sweep_line.rs", "source_sha256": "822b261f682911ea0c0370eaf17d9201a1e639b315359dcb6a3b877a229816e3", "source_git_blob": null, "sha256": "207f6a6b71b48a50e8d5bba3a7c5610b086f6548cd8746dac1785b6f4d2e0038" }, + { "path": "src/sweep/sweep_line.rs", "source_sha256": "822b261f682911ea0c0370eaf17d9201a1e639b315359dcb6a3b877a229816e3", "source_git_blob": null, "sha256": "b5b5e0751a93a7285bd9a8ed7dcd8a44e2ecab3749fcf902fcef6935eb001b41" }, { "path": "src/topology.rs", "source_sha256": "9c9b48bc3853884425127e2d64e8ed957ba0d27e1696e2c457e95282e52d6a5b", "source_git_blob": null, "sha256": "8729c2dd5941668f3d2805b6562d2d144d4e5156836b894b887394d9d2961aa7" }, { "path": "src/treevec.rs", "source_sha256": "d88b9fbf02fa9f318560e1d483d465555f2b696ae12c00f8e4f5b71ea6779445", "source_git_blob": null, "sha256": "d88b9fbf02fa9f318560e1d483d465555f2b696ae12c00f8e4f5b71ea6779445" }, { "path": "src/typed_vec.rs", "source_sha256": "3e9a2675b8a40d8fc4df0575bd9d0d16b5604d18e9b78638dd5a612b28fc4c30", "source_git_blob": null, "sha256": "3e9a2675b8a40d8fc4df0575bd9d0d16b5604d18e9b78638dd5a612b28fc4c30" }, diff --git a/vendor/linesweeper/src/sweep/sweep_line.rs b/vendor/linesweeper/src/sweep/sweep_line.rs index cc6e11a150..35115e318b 100644 --- a/vendor/linesweeper/src/sweep/sweep_line.rs +++ b/vendor/linesweeper/src/sweep/sweep_line.rs @@ -2157,6 +2157,12 @@ mod tests { _ => {} } check_positions(&line, 10); + for (i, entry) in line.segs.iter().enumerate() { + assert_eq!(line.position(entry.seg), Some(i)); + if let Some(old_seg) = entry.old_seg { + assert_eq!(line.position(old_seg), Some(i)); + } + } } check_positions(&line, next_seg); }