test(changelog): every fragment fixture carries a terminal cite
Scoped to the fixtures the new rule actually binds: a fragment whose predicate complaint is already its name, a smuggled heading, a dangling heading or the 300-character bound is left alone, so the diagnosis it tests is still the one it draws. The section-predicate fixtures are untouched (D4). The computed-length fixtures keep their measured lengths: the cite is seven characters, so an entry that must measure exactly 300 builds 293 of the run and lets the cite carry the rest. 33.md's cite lands on the last continuation line, which is the wrapped-citation case. Refs #262
This commit is contained in:
parent
c40d9412f6
commit
ef818001d0
4 changed files with 24 additions and 24 deletions
|
|
@ -452,7 +452,7 @@ fragment_tree fragments-bad-name 1.2.4-dev <<'EOF'
|
||||||
|
|
||||||
- The shipped entry.
|
- The shipped entry.
|
||||||
EOF
|
EOF
|
||||||
printf '%s\n' "- An entry (#1)." >"$TMP/fragments-bad-name/changelog.d/notes.md"
|
printf '%s\n' "- An entry." >"$TMP/fragments-bad-name/changelog.d/notes.md"
|
||||||
check "fragment mode quotes malformed-fragment diagnosis and file" 1 \
|
check "fragment mode quotes malformed-fragment diagnosis and file" 1 \
|
||||||
"fragment 'changelog.d/notes.md' is not named for its issue" \
|
"fragment 'changelog.d/notes.md' is not named for its issue" \
|
||||||
in_tree fragments-bad-name
|
in_tree fragments-bad-name
|
||||||
|
|
@ -484,7 +484,7 @@ check "fragment bare + stamped section + consumed directory passes" 0 \
|
||||||
"fragment mode" in_tree fragments-bare-stamped
|
"fragment mode" in_tree fragments-bare-stamped
|
||||||
|
|
||||||
cp -R "$TMP/fragments-bare-stamped" "$TMP/fragments-bare-survivor"
|
cp -R "$TMP/fragments-bare-stamped" "$TMP/fragments-bare-survivor"
|
||||||
printf '%s\n' "- This entry was not consumed." \
|
printf '%s\n' "- This entry was not consumed (#115)." \
|
||||||
>"$TMP/fragments-bare-survivor/changelog.d/115.md"
|
>"$TMP/fragments-bare-survivor/changelog.d/115.md"
|
||||||
check "fragment bare refuses and lists surviving fragments" 1 \
|
check "fragment bare refuses and lists surviving fragments" 1 \
|
||||||
"these fragments were not consumed: changelog.d/115.md" \
|
"these fragments were not consumed: changelog.d/115.md" \
|
||||||
|
|
@ -531,7 +531,7 @@ check "same changelog fails in legacy mode" 1 "development tree" \
|
||||||
|
|
||||||
mkdir -p "$TMP/env-tree"
|
mkdir -p "$TMP/env-tree"
|
||||||
printf '1.2.4-dev\n' >"$TMP/env-tree/VERSION"
|
printf '1.2.4-dev\n' >"$TMP/env-tree/VERSION"
|
||||||
printf '# Changelog\n\n## Unreleased\n\n- Pending (#1).\n' >"$TMP/env-tree/NOTES.md"
|
printf '# Changelog\n\n## Unreleased\n\n- Pending.\n' >"$TMP/env-tree/NOTES.md"
|
||||||
# A non-default changelog name proves the env var is honored, not the default.
|
# A non-default changelog name proves the env var is honored, not the default.
|
||||||
env_tree() {
|
env_tree() {
|
||||||
(cd "$TMP/env-tree" && CHANGELOG=NOTES.md VERSION_SOURCE=file bash "$SCRIPT")
|
(cd "$TMP/env-tree" && CHANGELOG=NOTES.md VERSION_SOURCE=file bash "$SCRIPT")
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ frag check-readonly 5.md <<'EOF'
|
||||||
- Five (#5).
|
- Five (#5).
|
||||||
EOF
|
EOF
|
||||||
cp -R "$TMP/check-readonly" "$TMP/check-readonly.before"
|
cp -R "$TMP/check-readonly" "$TMP/check-readonly.before"
|
||||||
check "--check prints the assembled body" 0 "Five." \
|
check "--check prints the assembled body" 0 "Five (#5)." \
|
||||||
in_tree check-readonly 0.2.0 2026-07-24 --check
|
in_tree check-readonly 0.2.0 2026-07-24 --check
|
||||||
check "--check is read-only: the tree is byte-identical before and after" 0 "" \
|
check "--check is read-only: the tree is byte-identical before and after" 0 "" \
|
||||||
diff -r "$TMP/check-readonly.before" "$TMP/check-readonly"
|
diff -r "$TMP/check-readonly.before" "$TMP/check-readonly"
|
||||||
|
|
@ -228,7 +228,7 @@ check "the defaulted stamp is a UTC date" 0 "" \
|
||||||
# --- --changelog and --dir override the defaults -----------------------------
|
# --- --changelog and --dir override the defaults -----------------------------
|
||||||
|
|
||||||
mkdir -p "$TMP/flagged/frags"
|
mkdir -p "$TMP/flagged/frags"
|
||||||
printf '# Changelog\n\n## 0.1.0 — 2026-07-01\n\n- Shipped (#1).\n' >"$TMP/flagged/NOTES.md"
|
printf '# Changelog\n\n## 0.1.0 — 2026-07-01\n\n- Shipped.\n' >"$TMP/flagged/NOTES.md"
|
||||||
printf -- '- Flagged entry (#2).\n' >"$TMP/flagged/frags/2.md"
|
printf -- '- Flagged entry (#2).\n' >"$TMP/flagged/frags/2.md"
|
||||||
check "--changelog and --dir override the defaults" 0 "" \
|
check "--changelog and --dir override the defaults" 0 "" \
|
||||||
"$TOOL" 0.2.0 2026-07-24 --changelog "$TMP/flagged/NOTES.md" --dir "$TMP/flagged/frags"
|
"$TOOL" 0.2.0 2026-07-24 --changelog "$TMP/flagged/NOTES.md" --dir "$TMP/flagged/frags"
|
||||||
|
|
@ -270,7 +270,7 @@ frag dangling 4.md <<'EOF'
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed entry (#4).
|
- Fixed entry.
|
||||||
EOF
|
EOF
|
||||||
check "a dangling grouped heading refuses, file and heading named" 1 \
|
check "a dangling grouped heading refuses, file and heading named" 1 \
|
||||||
"fragment 'changelog.d/4.md' has an empty heading: '### Added'" \
|
"fragment 'changelog.d/4.md' has an empty heading: '### Added'" \
|
||||||
|
|
@ -282,7 +282,7 @@ EOF
|
||||||
frag smuggled 6.md <<'EOF'
|
frag smuggled 6.md <<'EOF'
|
||||||
## 0.2.0 — 2026-07-24
|
## 0.2.0 — 2026-07-24
|
||||||
|
|
||||||
- An entry under a smuggled heading (#6).
|
- An entry under a smuggled heading.
|
||||||
EOF
|
EOF
|
||||||
check "a fragment carrying a '## ' line refuses, file named" 1 \
|
check "a fragment carrying a '## ' line refuses, file named" 1 \
|
||||||
"fragment 'changelog.d/6.md' carries a '## ' heading" \
|
"fragment 'changelog.d/6.md' carries a '## ' heading" \
|
||||||
|
|
@ -313,7 +313,7 @@ tree stray-case <<EOF
|
||||||
$BASE_CHANGELOG
|
$BASE_CHANGELOG
|
||||||
EOF
|
EOF
|
||||||
frag stray-case Fix-12.md <<'EOF'
|
frag stray-case Fix-12.md <<'EOF'
|
||||||
- Uppercase prefix (#12).
|
- Uppercase prefix.
|
||||||
EOF
|
EOF
|
||||||
check "Fix-12.md refuses on the name pattern" 1 "Fix-12.md" \
|
check "Fix-12.md refuses on the name pattern" 1 "Fix-12.md" \
|
||||||
in_tree stray-case 0.2.0
|
in_tree stray-case 0.2.0
|
||||||
|
|
|
||||||
|
|
@ -316,7 +316,7 @@ check "merge base IS HEAD: vacuous, named honestly" 0 "vacuous" run vacuous HEAD
|
||||||
# the env vars are honored the way the composite sets them.
|
# the env vars are honored the way the composite sets them.
|
||||||
init_repo env-tree
|
init_repo env-tree
|
||||||
mkdir -p "$TMP/env-tree/frags"
|
mkdir -p "$TMP/env-tree/frags"
|
||||||
printf '# Changelog\n\n## 0.1.0 — 2026-07-01\n\n- Shipped (#1).\n' >"$TMP/env-tree/NOTES.md"
|
printf '# Changelog\n\n## 0.1.0 — 2026-07-01\n\n- Shipped.\n' >"$TMP/env-tree/NOTES.md"
|
||||||
printf '0.1.1-dev\n' >"$TMP/env-tree/VERSION"
|
printf '0.1.1-dev\n' >"$TMP/env-tree/VERSION"
|
||||||
printf -- '- Flagged entry (#2).\n' >"$TMP/env-tree/frags/2.md"
|
printf -- '- Flagged entry (#2).\n' >"$TMP/env-tree/frags/2.md"
|
||||||
git -C "$TMP/env-tree" add -A
|
git -C "$TMP/env-tree" add -A
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ cat >"$PROBLEM_FIXTURE" <<'EOF'
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed entry (#22).
|
- Fixed entry.
|
||||||
|
|
||||||
## 1.3.0
|
## 1.3.0
|
||||||
|
|
||||||
|
|
@ -101,7 +101,7 @@ cat >"$PROBLEM_FIXTURE" <<'EOF'
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed entry (#22).
|
- Fixed entry.
|
||||||
|
|
||||||
## 1.4.0
|
## 1.4.0
|
||||||
|
|
||||||
|
|
@ -115,7 +115,7 @@ cat >"$PROBLEM_FIXTURE" <<'EOF'
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed entry (#22).
|
- Fixed entry.
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
assert_problem Unreleased 0 ""
|
assert_problem Unreleased 0 ""
|
||||||
|
|
@ -221,23 +221,23 @@ printf -- '- Cross-repo (#14).\n' >"$PF/ceremony-14.md"
|
||||||
check "fragment predicate: a cross-repo name passes" 0 "" \
|
check "fragment predicate: a cross-repo name passes" 0 "" \
|
||||||
changelog_fragment_problem "$PF/ceremony-14.md"
|
changelog_fragment_problem "$PF/ceremony-14.md"
|
||||||
|
|
||||||
printf -- '- Bad name (#12).\n' >"$PF/Fix-12.md"
|
printf -- '- Bad name.\n' >"$PF/Fix-12.md"
|
||||||
check "fragment predicate: an uppercase prefix is refused, file named" 1 "Fix-12.md" \
|
check "fragment predicate: an uppercase prefix is refused, file named" 1 "Fix-12.md" \
|
||||||
changelog_fragment_problem "$PF/Fix-12.md"
|
changelog_fragment_problem "$PF/Fix-12.md"
|
||||||
printf -- '- Bad name (#12).\n' >"$PF/notes.txt"
|
printf -- '- Bad name.\n' >"$PF/notes.txt"
|
||||||
check "fragment predicate: a non-.md file is refused, file named" 1 "notes.txt" \
|
check "fragment predicate: a non-.md file is refused, file named" 1 "notes.txt" \
|
||||||
changelog_fragment_problem "$PF/notes.txt"
|
changelog_fragment_problem "$PF/notes.txt"
|
||||||
printf -- '- Bad name (#12).\n' >"$PF/12.markdown"
|
printf -- '- Bad name.\n' >"$PF/12.markdown"
|
||||||
check "fragment predicate: .markdown is refused, file named" 1 "12.markdown" \
|
check "fragment predicate: .markdown is refused, file named" 1 "12.markdown" \
|
||||||
changelog_fragment_problem "$PF/12.markdown"
|
changelog_fragment_problem "$PF/12.markdown"
|
||||||
printf -- '- No number (#1).\n' >"$PF/notes.md"
|
printf -- '- No number.\n' >"$PF/notes.md"
|
||||||
check "fragment predicate: a name with no trailing issue number is refused" 1 "notes.md" \
|
check "fragment predicate: a name with no trailing issue number is refused" 1 "notes.md" \
|
||||||
changelog_fragment_problem "$PF/notes.md"
|
changelog_fragment_problem "$PF/notes.md"
|
||||||
|
|
||||||
cat >"$PF/20.md" <<'EOF'
|
cat >"$PF/20.md" <<'EOF'
|
||||||
## 1.0.0 — 2026-07-24
|
## 1.0.0 — 2026-07-24
|
||||||
|
|
||||||
- Smuggled heading (#20).
|
- Smuggled heading.
|
||||||
EOF
|
EOF
|
||||||
check "fragment predicate: a '## ' line is refused — the heading is the assembler's" 1 \
|
check "fragment predicate: a '## ' line is refused — the heading is the assembler's" 1 \
|
||||||
"the section heading is the assembler's to write" \
|
"the section heading is the assembler's to write" \
|
||||||
|
|
@ -253,7 +253,7 @@ cat >"$PF/22.md" <<'EOF'
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed entry (#22).
|
- Fixed entry.
|
||||||
EOF
|
EOF
|
||||||
check "fragment predicate: a dangling grouped heading is refused, heading named" 1 \
|
check "fragment predicate: a dangling grouped heading is refused, heading named" 1 \
|
||||||
"has an empty heading: '### Added'" \
|
"has an empty heading: '### Added'" \
|
||||||
|
|
@ -274,14 +274,14 @@ check "length bound: the refusal names the bound and the split fix" 1 \
|
||||||
"the bound is 300: split it into multiple '- ' entries in this same fragment" \
|
"the bound is 300: split it into multiple '- ' entries in this same fragment" \
|
||||||
changelog_fragment_problem "$PF/30.md"
|
changelog_fragment_problem "$PF/30.md"
|
||||||
|
|
||||||
printf -- '- %s\n' "$(mkchars 300)" >"$PF/31.md"
|
printf -- '- %s (#31).\n' "$(mkchars 293)" >"$PF/31.md"
|
||||||
check "length bound: an entry of exactly 300 passes" 0 "" \
|
check "length bound: an entry of exactly 300 passes" 0 "" \
|
||||||
changelog_fragment_problem "$PF/31.md"
|
changelog_fragment_problem "$PF/31.md"
|
||||||
|
|
||||||
{
|
{
|
||||||
printf -- '- %s\n' "$(mkchars 150)"
|
printf -- '- %s (#32).\n' "$(mkchars 143)"
|
||||||
printf -- '- %s\n' "$(mkchars 150)"
|
printf -- '- %s (#32).\n' "$(mkchars 143)"
|
||||||
printf -- '- %s\n' "$(mkchars 150)"
|
printf -- '- %s (#32).\n' "$(mkchars 143)"
|
||||||
} >"$PF/32.md"
|
} >"$PF/32.md"
|
||||||
check "length bound: several within-bound entries pass though the file totals over 300" 0 "" \
|
check "length bound: several within-bound entries pass though the file totals over 300" 0 "" \
|
||||||
changelog_fragment_problem "$PF/32.md"
|
changelog_fragment_problem "$PF/32.md"
|
||||||
|
|
@ -291,14 +291,14 @@ check "length bound: several within-bound entries pass though the file totals ov
|
||||||
printf ' %s\n' "$(mkchars 50)"
|
printf ' %s\n' "$(mkchars 50)"
|
||||||
printf ' %s\n' "$(mkchars 50)"
|
printf ' %s\n' "$(mkchars 50)"
|
||||||
printf ' %s\n' "$(mkchars 50)"
|
printf ' %s\n' "$(mkchars 50)"
|
||||||
printf ' %s\n' "$(mkchars 50)"
|
printf ' %s (#33).\n' "$(mkchars 50)"
|
||||||
} >"$PF/33.md"
|
} >"$PF/33.md"
|
||||||
check "length bound: a ~250-character entry wrapped over four continuation lines passes" 0 "" \
|
check "length bound: a ~250-character entry wrapped over four continuation lines passes" 0 "" \
|
||||||
changelog_fragment_problem "$PF/33.md"
|
changelog_fragment_problem "$PF/33.md"
|
||||||
|
|
||||||
{
|
{
|
||||||
printf '### Added\n\n'
|
printf '### Added\n\n'
|
||||||
printf -- '- %s\n' "$(mkchars 300)"
|
printf -- '- %s (#34).\n' "$(mkchars 293)"
|
||||||
} >"$PF/34.md"
|
} >"$PF/34.md"
|
||||||
check "length bound: a '### ' heading counts toward no entry — 300 under it still passes" 0 "" \
|
check "length bound: a '### ' heading counts toward no entry — 300 under it still passes" 0 "" \
|
||||||
changelog_fragment_problem "$PF/34.md"
|
changelog_fragment_problem "$PF/34.md"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue