Skip to content

feat: add cross-format integration tests and CLI end-to-end tests#42

Merged
alvinreal merged 1 commit intomainfrom
fix/issue-14
Feb 21, 2026
Merged

feat: add cross-format integration tests and CLI end-to-end tests#42
alvinreal merged 1 commit intomainfrom
fix/issue-14

Conversation

@alvinreal
Copy link
Owner

Summary

Closes #14 — Integration tests.

Changes

New test file: tests/cross_format.rs (45 integration tests)

Cross-format roundtrip tests (all pairs):

  • JSON ↔ YAML (simple, nested, types with null, unicode, large 500-row dataset)
  • JSON ↔ TOML (simple, nested, types, unicode)
  • JSON ↔ CSV (array of objects, large dataset)
  • YAML ↔ TOML (simple, nested, types, unicode)
  • YAML ↔ CSV (both directions)
  • TOML ↔ CSV (array of tables extraction)

Three-format chain tests (A→B→C→A):

  • JSON → YAML → TOML → JSON
  • YAML → TOML → JSON → YAML
  • JSON → CSV → YAML → JSON
  • CSV → JSON → TOML → CSV

Format limitation edge cases:

  • TOML rejects top-level arrays
  • TOML null becomes string "null"
  • CSV flattens nested objects to JSON strings
  • CSV type inference preserves int/float/bool on roundtrip
  • TOML datetime becomes string in Value

CLI end-to-end tests (11):

  • json→yaml, yaml→json, json→toml, csv→json, json→csv
  • --formats flag, file output (-o), stdin→stdout
  • Unknown format error, --pretty flag, --compact flag

Bug fix:

  • CSV csv_field_to_string for Float now ensures decimal point is preserved (e.g., 87.0 instead of 87), so roundtripping floats through CSV maintains the Float type via type inference.

All checks pass: cargo build, cargo test (291 tests), cargo fmt --check, cargo clippy -D warnings.

- Add tests/cross_format.rs with 45 integration tests covering:
  - All format pair roundtrips: JSON↔YAML, JSON↔TOML, JSON↔CSV,
    YAML↔TOML, YAML↔CSV, TOML↔CSV
  - Three-format chains: JSON→YAML→TOML→JSON, YAML→TOML→JSON→YAML,
    JSON→CSV→YAML→JSON, CSV→JSON→TOML→CSV
  - Format-specific limitations: TOML top-level array rejection,
    TOML null→string conversion, CSV nested object flattening,
    CSV type inference, TOML datetime→string
  - Unicode cross-format roundtrips
  - Large dataset (500 rows) cross-format roundtrips
  - 11 CLI end-to-end tests: json→yaml, yaml→json, json→toml,
    csv→json, json→csv, --formats flag, file output, stdin→stdout,
    unknown format error, --pretty flag, --compact flag
- Fix CSV float serialization to preserve decimal point (87.0 not 87)

Fixes #14
@alvinreal alvinreal merged commit 10b944d into main Feb 21, 2026
6 checks passed
@alvinreal alvinreal deleted the fix/issue-14 branch February 21, 2026 07:17
@github-actions github-actions bot mentioned this pull request Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cross-format round-trip test suite

1 participant