From 46ce2045854a67985738dab631be17f8dd63e8fb Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 10:54:36 -0800 Subject: [PATCH 1/2] craft-ods: build the testing module only for tests and the test-support feature `craft_ods::testing`, which builds small `.ods` packages in code, was compiled into every build of the crate. It is now behind `cfg(any(test, feature = "test-support"))`, as `craft-sf2`'s `fixture` is. The crate's own integration test and doctest enable the feature through a dev-dependency on the crate itself. A crate that calls `craft_ods::testing` now needs `features = ["test-support"]`. Users of `craft_ods::testing`: the crate doctest (`src/lib.rs`) and `tests/read.rs`. No other craft-libs crate uses it. --- Cargo.lock | 1 + crates/ods/Cargo.toml | 5 +++++ crates/ods/README.md | 6 ++++++ crates/ods/src/lib.rs | 1 + 4 files changed, 13 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 3d8cf4a7b3..3d002a6f46 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2095,6 +2095,7 @@ name = "craft-ods" version = "0.1.0" dependencies = [ "craft-odf", + "craft-ods", "craft-sheet", "craft-xml", "thiserror 2.0.21", diff --git a/crates/ods/Cargo.toml b/crates/ods/Cargo.toml index 814e6d9c3e..3b405d8ee4 100644 --- a/crates/ods/Cargo.toml +++ b/crates/ods/Cargo.toml @@ -10,6 +10,10 @@ repository.workspace = true [lints] workspace = true +[features] +# `testing`: small `.ods` packages built in code, for the tests of crates that read them. +test-support = [] + [dependencies] craft-odf = { workspace = true } craft-sheet = { workspace = true } @@ -18,3 +22,4 @@ thiserror = { workspace = true } [dev-dependencies] craft-odf = { workspace = true } +craft-ods = { path = ".", features = ["test-support"] } diff --git a/crates/ods/README.md b/crates/ods/README.md index eb255349a6..3c9111b71a 100644 --- a/crates/ods/README.md +++ b/crates/ods/README.md @@ -35,3 +35,9 @@ expanded; blank padding past the grid's edge is clipped, data past it is an erro `craft-xml`'s depth and attribute limits. At most 1024 tables. `Options::only_sheet` keeps one sheet's cells and lists the others by name. + +## Features + +- `test-support`: `testing`, which builds small `.ods` packages in code (`spreadsheet`, + `content`, `package`), for the tests of crates that read spreadsheets. Not a general + spreadsheet writer. diff --git a/crates/ods/src/lib.rs b/crates/ods/src/lib.rs index e96e22df2f..3adcc14313 100644 --- a/crates/ods/src/lib.rs +++ b/crates/ods/src/lib.rs @@ -30,6 +30,7 @@ mod content; mod model; +#[cfg(any(test, feature = "test-support"))] #[doc(hidden)] pub mod testing; From 804d0aefe5a3397eb5ba01c59eaa98349d3df619 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 11:56:24 -0800 Subject: [PATCH 2/2] craft-ods: state the test-support feature in full sentences in the README --- crates/ods/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/ods/README.md b/crates/ods/README.md index 3c9111b71a..bac06a2bf9 100644 --- a/crates/ods/README.md +++ b/crates/ods/README.md @@ -38,6 +38,6 @@ expanded; blank padding past the grid's edge is clipped, data past it is an erro ## Features -- `test-support`: `testing`, which builds small `.ods` packages in code (`spreadsheet`, - `content`, `package`), for the tests of crates that read spreadsheets. Not a general +- `test-support` enables `testing`, which builds small `.ods` packages in code (`spreadsheet`, + `content`, `package`) for the tests of crates that read spreadsheets. It is not a general spreadsheet writer.