PURGE test: add the zero-length line directly

#344 made JSON LINE refuse coincident points; files can still hold them, so
the test that checks PURGE Zero-length adds one to the drawing directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas 2026-10-10 17:45:43 -04:00
parent 9b7d7bd090
commit 1ff426dbe7
1 changed files with 4 additions and 1 deletions

View File

@ -3,6 +3,7 @@
use cadcraft_engine::Session;
use cadcraft_engine::doc::EntityKind;
use cadcraft_engine::geom::Vec3;
use serde_json::json;
/// Unused: blocks U1 and U2, layer Spare, linetype DASHED, text style Notes, dimension style Arch.
@ -75,7 +76,9 @@ fn verify_asks_for_each_name_and_absent_types_take_their_tokens() {
assert!(s.log[n..].iter().any(|l| l.contains("No unreferenced")), "{:?}", &s.log[n..]);
assert_eq!(count(&s, |k| matches!(k, EntityKind::Line(_))), 1);
// Zero-length geometry purges at once.
s.execute("line", &json!({ "points": [[3, 3], [3, 3]] })).unwrap();
// (Drawn directly: the LINE command refuses coincident points, but files can hold them.)
let zero = EntityKind::Line(cadcraft_engine::doc::Line { a: Vec3::new(3.0, 3.0, 0.0), b: Vec3::new(3.0, 3.0, 0.0) });
s.doc_mut().unwrap().add(&cadcraft_engine::doc::Space::Model, cadcraft_engine::doc::Common::default(), zero).unwrap();
s.script("-PURGE Z\n").unwrap();
assert!(s.running.is_none(), "{}", s.prompt_text());
assert_eq!(count(&s, |k| matches!(k, EntityKind::Line(_))), 1);