test: reduce and improve tests in src/compile/types.rs#1173
Draft
github-actions[bot] wants to merge 1 commit into
Draft
test: reduce and improve tests in src/compile/types.rs#1173github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test Suite Reduction:
src/compile/types.rsWhat was wrong
test_frontmatter_inlined_imports_false_explicitassert!(!fm.inlined_imports)) totest_frontmatter_inlined_imports_defaults_to_false. With#[serde(default)]on abool, an absent key and an explicitfalseare indistinguishable — both paths producefalseand both tests make the same assertion.test_supply_chain_feed_only_validatesvalidate()only errors whenregistryisSomewithout a connection. Withregistry = None(feed-only),validate()always returnsOk(())unconditionally — the assertion could never fail regardless of what the validate logic did.test_permissions_defaultPermissionsConfig::default(), which is never invoked in any production code path. This tested the#[derive(Default)]macro's guaranteed behaviour (Option fields become None), not the actual deserialization contract.test_cache_memory_bool_falseCacheMemoryToolConfig::Enabled(_)always returns&[]fromallowed_extensions(). Theassert!(cm.allowed_extensions().is_empty())assertion was trivially true for theEnabledvariant regardless of the bool value.test_lean_bool_falseLeanRuntimeConfig::Enabled(_)always returnsNonefromtoolchain(). Theassert!(lean.toolchain().is_none())assertion was trivially true — only theWithOptionsvariant can returnSome, and that is already covered bytest_lean_with_toolchain.Changes
test_frontmatter_inlined_imports_false_explicittest_frontmatter_inlined_imports_defaults_to_falsetest_supply_chain_feed_only_validatestest_permissions_defaultpermissions: {}from YAML instead of callingDefault::default()— tests the actual serde contract and guards against accidentally adding required fieldstest_cache_memory_bool_falseallowed_extensions().is_empty()assertion; kept the meaningful!cm.is_enabled()checktest_lean_bool_falsetoolchain().is_none()assertion; kept the meaningful!lean.is_enabled()checkVerification
cargo test: all tests pass ✅cargo clippy --all-targets --all-features: no warnings or errors ✅Warning
Firewall blocked 2 domains
The following domains were blocked by the firewall during workflow execution:
spsprodeus21.vssps.visualstudio.comspsprodweu4.vssps.visualstudio.comSee Network Configuration for more information.