Skip to content

test: add NDJSON-specific edge case coverage #154

@membphis

Description

@membphis

Background

qjson is a single-document parser — it does not provide a native NDJSON API. Callers split lines themselves and call qjson_parse() per record. This means most NDJSON edge cases (empty lines, CRLF, whitespace-only lines, error recovery) are caller responsibility.

Goal

Add systematic edge case coverage for scenarios that ARE qjson's responsibility when parsing individual NDJSON records.

Scope

Edge Cases to Cover

Edge Case qjson Responsibility Rationale
UTF-8 BOM at input start Yes RFC 8259 prohibits BOM; qjson should reject
Large single record (1MB+) Yes Verify no stack overflow or perf regression
Many small records (10K+) Yes Verify no memory leaks in parse/free cycle

Out of Scope (Caller Responsibility)

  • Empty lines / whitespace-only lines → caller's split logic
  • CRLF vs LF handling → caller's line trimming
  • Malformed middle record error recovery → caller decides whether to continue
  • Streaming NDJSON → qjson requires full buffer per record

Acceptance Criteria

  • Add tests/ndjson_edge_cases.rs with:
    • BOM handling test (expect parse error per RFC 8259)
    • 1MB+ single-line record stress test
    • 10K+ small record batch test (parse/free cycle)
  • All tests pass in both EAGER and LAZY modes
  • Document that qjson is a single-document parser

Technical Notes

  • Follow existing test patterns from ffi_depth_stress.rs
  • Use DocGuard RAII pattern for cleanup
  • BOM bytes: \xef\xbb\xbf (UTF-8 BOM)

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions