test: reduce and improve tests in src/compile/types.rs#1173
Conversation
- Remove test_frontmatter_inlined_imports_false_explicit: duplicate of
test_frontmatter_inlined_imports_defaults_to_false — both assert
key and explicit `false` are indistinguishable.
- Strengthen test_supply_chain_feed_only_validates: the original assertion
`validate().is_ok()` on a feed-only config was vacuous because
`validate()` only errors when `registry` is Some without a connection.
Now also tests combined feed + registry-with-connection, which exercises
more of the validation logic.
- Rewrite test_permissions_default: previously called
`PermissionsConfig::default()` which is only ever called from this test
(never in production). Replaced with deserialization of `permissions: {}`,
which guards against accidentally adding a required field or a non-None
serde default — a meaningful regression check.
- Remove vacuous `allowed_extensions().is_empty()` assertion from
test_cache_memory_bool_false: `CacheMemoryToolConfig::Enabled(_)` always
returns `&[]` regardless of the bool, so this assertion can never fail.
The coverage is already provided by test_cache_memory_with_options.
- Remove vacuous `toolchain().is_none()` assertion from test_lean_bool_false:
`LeanRuntimeConfig::Enabled(_)` always returns `None` from `toolchain()`;
only the `WithOptions` variant can return `Some`. That case is covered by
test_lean_with_toolchain.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@copilot The new assertions are welcome: • the combined feed + registry -with- service-connection validate() check in test_supply_chain_feed_only_validates However, three deletions drop real, non-redundant coverage:
Could you restore these three? Trimming the truly redundant bits is fine — e.g. dropping test_generate_stage_prefix -style single-word duplicates — but #1098 was just closed for removing the only coverage of a specific behavior, and items 1 and 3 here are the same pattern. Happy to merge once they're back in alongside the new assertions. |
Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Restored all three in commit
|
Summary
Improves the test suite in
src/compile/types.rsby strengthening weak tests and restoring genuine coverage that had been incorrectly identified as redundant.Strengthened tests
test_supply_chain_feed_only_validatestest_permissions_defaultpermissions: {}from YAML instead of callingDefault::default()— tests the actual serde contract and guards against accidentally adding required fieldsRetained tests (with corrections)
test_frontmatter_inlined_imports_false_explicitinlined-imports: falseoverride path — distinct from the default (absent key) pathtest_cache_memory_bool_falseassert!(cm.allowed_extensions().is_empty())retained — verifies theEnabledvariant's accessor returns no extensions, a distinct path fromis_enabled()test_lean_bool_falseassert!(lean.toolchain().is_none())retained — verifies theEnabledvariant returnsNone; not covered bytest_lean_with_toolchainwhich only exercisesWithOptionsTest plan
cargo test: all tests pass ✅cargo clippy --all-targets --all-features: no warnings or errors ✅