Repository navigation
Add missing regression coverage for blank-title H1 skip (issue #23) - #58
Merged
Merged
Conversation
Issue #23 reports mdstore writing a bare `# ` heading when an item's title is empty (affects comment items in centy-daemon, which have no title concept). The fix already landed in ab2db95 (closing duplicate issue #15) for both generate_frontmatter and generate_frontmatter_raw, but only generate_frontmatter had regression tests. Add the missing coverage for generate_frontmatter_raw (empty title/no body, whitespace-only title/with body), matching the existing test style, so the raw-value code path used for untyped metadata stays protected. Closes #23
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.
Bug (issue #23)
mdstorewas writing a bare#(H1 with nothing after it) into generated markdown when an item's title is empty/blank — this affects comment items in centy-daemon, which have no title concept.Status
The actual fix already exists on
main(commit ab2db95, "fix: skip empty H1 heading when title is blank"), which was merged closing the duplicate issue #15. Bothgenerate_frontmatterandgenerate_frontmatter_rawinsrc/frontmatter.rsalready trim the title and skip emitting the# {title}heading line (and the blank line that would follow it) when the trimmed title is empty, for both the with-body and without-body cases.However, only
generate_frontmatterhad regression tests for this branch —generate_frontmatter_raw(the untypedserde_yaml::Valuevariant, which is the one relevant to consumers like centy-daemon that don't have a strongly-typed title field) had no test coverage at all, for this or anything else.Change
Adds two tests mirroring the existing
generate_frontmatterblank-title tests, forgenerate_frontmatter_raw:test_generate_frontmatter_raw_empty_title_no_bodytest_generate_frontmatter_raw_whitespace_only_title_with_bodyNo production code changes — the behavior was already correct, this just closes the test gap so the raw-value path stays protected against regressions.
Verified
cargo build— cleancargo test— 115 passed (was 113), 0 failedcargo clippy --all-targets --all-features -- -D warnings— no warningscargo fmt --check— cleanCloses #23