Skip to content

test: add macro-generated test batteries for report types #168

@rocketman-code

Description

@rocketman-code

Context

Parent: #160

Five report types (TraceReport, ChainReport, CutReport, DiffReport, PackagesReport) each need the same set of tests: JSON field validation, terminal output format, empty-data handling, large-data handling. Writing these by hand is repetitive and error-prone — exactly the case RFR recommends macro-generated test batteries.

Expected Behavior

A test_battery! macro that generates a standard set of tests for each report type, reducing per-type boilerplate to one line.

Scope

  • test_battery! macro that takes a report type and a constructor closure
  • Generated tests per type:
    • to_json() produces valid JSON
    • to_json() field names match expected set
    • to_terminal() produces non-empty output
    • to_terminal() with color: false produces no ANSI codes
    • Empty data (zero modules/packages) doesn't panic
    • Round-trip: to_json() contains all data from the struct
  • Add one invocation per report type

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low priorityenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions