test: cover new Badges/Topology MUST-Sections (S2 iter)
User-feedback iteration on S2 PoC template:
- Update validate_readme_structure test-data ('complete' + 'missing_api')
to use new bold-list Badges + ## Topology H2 heading.
- Add 'missing_topology' case: README without ## Topology heading must
report Topology as missing MUST-Section.
- Add 'missing_badges' case: README without **Lib-ID:** bold-line must
report Badges as missing MUST-Section.
Assertion-count: 32 -> 35 (+3 new). README Coverage-Statement updated.
This commit is contained in:
67
init.lua
67
init.lua
@@ -132,9 +132,12 @@ end
|
||||
local complete = [[
|
||||
# lib-core.foo
|
||||
Abstract.
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| Version | 0.1.0 |
|
||||
|
||||
**Version:** 0.1.0
|
||||
**Lib-ID:** lib-core.foo
|
||||
**Requires:** (none)
|
||||
|
||||
## Topology
|
||||
|
||||
<!-- topology:start -->
|
||||
<!-- topology:end -->
|
||||
@@ -154,7 +157,11 @@ Sig.
|
||||
local missing_api = [[
|
||||
# lib-core.foo
|
||||
Abstract.
|
||||
| F | V |
|
||||
|
||||
**Version:** 0.1.0
|
||||
**Lib-ID:** lib-core.foo
|
||||
|
||||
## Topology
|
||||
|
||||
<!-- topology:start -->
|
||||
<!-- topology:end -->
|
||||
@@ -170,6 +177,58 @@ Abstract.
|
||||
end
|
||||
engine.test.assert(has_api_missing, "validate: missing-sections list contains 'API'")
|
||||
|
||||
-- Missing Topology heading: should detect Topology as missing MUST-section
|
||||
local missing_topology = [[
|
||||
# lib-core.foo
|
||||
Abstract.
|
||||
|
||||
**Version:** 0.1.0
|
||||
**Lib-ID:** lib-core.foo
|
||||
|
||||
<!-- topology:start -->
|
||||
<!-- topology:end -->
|
||||
|
||||
## API
|
||||
|
||||
### `foo.bar()`
|
||||
Sig.
|
||||
|
||||
## References
|
||||
- spec
|
||||
]]
|
||||
local r_topo = api.validate_readme_structure(missing_topology, "core")
|
||||
engine.test.assert(#r_topo.missing_sections > 0, "validate: missing Topology heading -> reports missing")
|
||||
local has_topology_missing = false
|
||||
for _, s in ipairs(r_topo.missing_sections) do
|
||||
if s == "Topology" then has_topology_missing = true end
|
||||
end
|
||||
engine.test.assert(has_topology_missing, "validate: missing-sections list contains 'Topology'")
|
||||
|
||||
-- Missing Badges (no **Lib-ID:** bold line): should detect Badges as missing
|
||||
local missing_badges = [[
|
||||
# lib-core.foo
|
||||
Abstract.
|
||||
|
||||
## Topology
|
||||
|
||||
<!-- topology:start -->
|
||||
<!-- topology:end -->
|
||||
|
||||
## API
|
||||
|
||||
### `foo.bar()`
|
||||
Sig.
|
||||
|
||||
## References
|
||||
- spec
|
||||
]]
|
||||
local r_badges = api.validate_readme_structure(missing_badges, "core")
|
||||
local has_badges_missing = false
|
||||
for _, s in ipairs(r_badges.missing_sections) do
|
||||
if s == "Badges" then has_badges_missing = true end
|
||||
end
|
||||
engine.test.assert(has_badges_missing, "validate: missing-sections list contains 'Badges'")
|
||||
|
||||
-- Tier community: lockerer
|
||||
local r3 = api.validate_readme_structure(missing_api, "community")
|
||||
engine.test.equals(#r3.missing_sections, 0, "validate: tier=community -> no enforcement")
|
||||
|
||||
Reference in New Issue
Block a user