test: declarative fixture+snapshot extraction tests#83
Draft
ubmarco wants to merge 4 commits into
Draft
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #83 +/- ##
==========================================
+ Coverage 90.82% 91.40% +0.57%
==========================================
Files 33 34 +1
Lines 2942 3012 +70
Branches 315 322 +7
==========================================
+ Hits 2672 2753 +81
+ Misses 168 160 -8
+ Partials 102 99 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Add tests/data/extraction/ with a README describing the declarative extraction-test format: per-case YAML fixtures (lang/config/source) plus a normalized JSON snapshot of the extraction output (needs/need_refs/marked_rst/ warnings). Harness + fixtures + snapshots follow in subsequent commits.
Add a parametrized harness that loads tests/data/extraction/*.yaml cases
(lang/config/source), runs SourceAnalyse on a temp source file, normalizes the
output to {needs,need_refs,marked_rst,warnings} (1-indexed lines) and asserts a
single-file JSON snapshot per case (ExtractionSnapshotExtension).
Fixtures: default one-liners across all eight languages (cpp,c,python,csharp,
rust,yaml in oneline.yaml; go,jsonc in extra_languages.yaml).
…ixtures Add declarative fixtures + JSON snapshots for: escape-sequence resolution (escapes.yaml), custom one-line configs incl bracketed + space-separated (custom_config.yaml), need-id references with default/custom markers (need_refs.yaml), four parser warning kinds (warnings.yaml), and @rst/@endrst blocks (marked_rst.yaml). Add an 'extract' fixture toggle (subset of oneline/need_refs/rst, default all) so a focused case isn't polluted by the '@' one-line start also matching '@need-ids:'/'@rst'. 25 cases total; all snapshots captured.
f6e0be6 to
83d6cd1
Compare
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.
What
Adds a declarative fixture + snapshot test layer for C/C++/… marker
extraction. Each case is a YAML fixture (input:
lang+config+source)plus a captured JSON snapshot (expected: the normalized extraction output), so
the whole language matrix is covered as data rather than as bespoke test
functions.
Details
tests/test_extraction_fixtures.py— parametrizes overtests/data/extraction/*.yaml, runsSourceAnalyseon a temp source file,normalizes the result to
{needs, need_refs, marked_rst, warnings}(1-indexedlines), and asserts a single-file JSON snapshot per case (via a new
ExtractionSnapshotExtensioninconftest.py).tests/data/extraction/): default one-liners across all eightlanguages (cpp, c, python, csharp, rust, yaml, go, jsonc); escape-sequence
resolution; custom one-line configs (bracketed + space-separated); need-id
references (default + custom marker); four parser warning kinds; and
@rst/@endrstblocks.extracttoggle (subset ofoneline/need_refs/rst)keeps a case focused so, e.g., a
@need-ids:marker isn't also parsed as aone-line need.
tests/data/extraction/README.md.Scope
Test-only; no library changes. Covers the marker-extraction surface; existing
parser / pipeline / discovery tests are untouched. (
newline_in_fieldisreachable only at the parser level — noted in
warnings.yaml.)Running