Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Tests

Running Tests

# All tests
cargo test

# With output display
cargo test -- --nocapture

# Specific test
cargo test test_name

# Integration tests only
cargo test --test integration

Test Structure

The project has 20 integration test files in tests/, plus inline unit tests in several src/ modules.

Unit Tests (inline #[cfg(test)] mod tests in src/)

  • json.rs, json_arrow.rs, json_leaf_infer.rs, json_normalize.rs — JSON parsing, nested-type inference, flattening
  • xlsx.rs, to_xlsx.rs — spreadsheet reading and XLSX writing
  • memory.rs — /proc/meminfo parsing, adaptive block/thread sizing (Linux only)
  • diag.rs — phase-timing/RSS instrumentation
  • conversion/json_pipeline.rs — parallel nested-JSON block engine

Integration Tests (tests/)

  • schema_tests.rs, schema_threshold_tests.rs, schema_override_tests.rs — type inference, timestamp confidence threshold, forced column types
  • conversions_tests.rs — value → Arrow conversion
  • delimiter_tests.rs — delimiter auto-detection
  • analysis_tests.rs, error_analysis_tests.rs — block analysis, error counters
  • heuristic_robustness_tests.rs, noise_robustness_tests.rs — header/type heuristics under noisy data
  • strict_order_tests.rs — strict block ordering under parallel conversion
  • integration_pipeline_tests.rs — end-to-end CSV → Parquet pipeline
  • normalized_tests.rs — large scenario suite (also covers .gz/.zst auto-decompression)
  • utils_tests.rs — utilities (delimiter/header/date helpers)
  • xlsx_e2e.rs — Excel → Parquet round-trip
  • export_formats_tests.rs — JSON-array and multi-sheet-XLSX round-trips (forward and reverse)
  • inverse_and_inspect_tests.rs — Parquet → CSV/JSONL and schema/stats inspection
  • parquet_to_csv_robust_tests.rs — Parquet → CSV robustness
  • nested_json_tests.rs — native nested-JSON Arrow path and --flatten (separator, max-level, mixed depth)
  • parquet_rewrite_tests.rs — Parquet column renaming (GUI’s column-rename feature)
  • preview_tests.rs — headless data preview (--preview, viewer)

Fixture Generation

The src/data_generator.rs binary generates test data in CSV, TSV, JSON, and JSONL formats:

cargo run --bin data_generator

Produces datasets in datasets_tests/ with various noise strategies, typed columns, and edge-case scenarios.

Python Test

A Python script allows validating Parquet output:

python3 test_convert_to_parquet.py

Requirements: pyarrow (pip install pyarrow).

Makefile

make test    # cargo test
make check   # cargo check (quick verification)
make lint    # cargo clippy -- -D warnings
make fmt     # cargo fmt