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:
@@ -13,8 +13,8 @@ Per Fault-Injection-Audit-Convention (2026-05-16):
|
|||||||
| `diff_surface` | 5 | Equal (no diff), surface-superset (missing), doc-superset (stale) |
|
| `diff_surface` | 5 | Equal (no diff), surface-superset (missing), doc-superset (stale) |
|
||||||
| `grep_engine_calls` | 5 | 3 unique calls, no-calls edge |
|
| `grep_engine_calls` | 5 | 3 unique calls, no-calls edge |
|
||||||
| `generate_topology_block` | 6 | Lib-with-deps+engine, asset-lib (no deps, no engine) |
|
| `generate_topology_block` | 6 | Lib-with-deps+engine, asset-lib (no deps, no engine) |
|
||||||
| `validate_readme_structure` | 5 | Complete core, missing-API core, community-tier-no-enforcement |
|
| `validate_readme_structure` | 8 | Complete core, missing-API core, missing-Topology, missing-Badges, community-tier-no-enforcement |
|
||||||
| **TOTAL** | **32** | |
|
| **TOTAL** | **35** | |
|
||||||
|
|
||||||
### Tested-Surface
|
### Tested-Surface
|
||||||
- All 6 public functions of `lib-core.api-discovery` v0.1.0.
|
- All 6 public functions of `lib-core.api-discovery` v0.1.0.
|
||||||
|
|||||||
67
init.lua
67
init.lua
@@ -132,9 +132,12 @@ end
|
|||||||
local complete = [[
|
local complete = [[
|
||||||
# lib-core.foo
|
# lib-core.foo
|
||||||
Abstract.
|
Abstract.
|
||||||
| Field | Value |
|
|
||||||
|---|---|
|
**Version:** 0.1.0
|
||||||
| Version | 0.1.0 |
|
**Lib-ID:** lib-core.foo
|
||||||
|
**Requires:** (none)
|
||||||
|
|
||||||
|
## Topology
|
||||||
|
|
||||||
<!-- topology:start -->
|
<!-- topology:start -->
|
||||||
<!-- topology:end -->
|
<!-- topology:end -->
|
||||||
@@ -154,7 +157,11 @@ Sig.
|
|||||||
local missing_api = [[
|
local missing_api = [[
|
||||||
# lib-core.foo
|
# lib-core.foo
|
||||||
Abstract.
|
Abstract.
|
||||||
| F | V |
|
|
||||||
|
**Version:** 0.1.0
|
||||||
|
**Lib-ID:** lib-core.foo
|
||||||
|
|
||||||
|
## Topology
|
||||||
|
|
||||||
<!-- topology:start -->
|
<!-- topology:start -->
|
||||||
<!-- topology:end -->
|
<!-- topology:end -->
|
||||||
@@ -170,6 +177,58 @@ Abstract.
|
|||||||
end
|
end
|
||||||
engine.test.assert(has_api_missing, "validate: missing-sections list contains 'API'")
|
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
|
-- Tier community: lockerer
|
||||||
local r3 = api.validate_readme_structure(missing_api, "community")
|
local r3 = api.validate_readme_structure(missing_api, "community")
|
||||||
engine.test.equals(#r3.missing_sections, 0, "validate: tier=community -> no enforcement")
|
engine.test.equals(#r3.missing_sections, 0, "validate: tier=community -> no enforcement")
|
||||||
|
|||||||
Reference in New Issue
Block a user