The file test_truncated_flate_recovery.rs does not exist. Documented related test files and fixture patterns. Identified that test_truncated_mid_stream() in error_recovery_integration.rs is the closest existing test for truncated stream handling. Acceptance criteria: - Test file located: NOT FOUND (file does not exist) - Related test structures: DOCUMENTED - Existing test functions: LISTED
2.7 KiB
Bead bf-fyfbf: Locate and read truncated-flate test file
Summary
The test file crates/pdftract-core/tests/test_truncated_flate_recovery.rs does not exist.
What was found
Related test files that DO exist:
-
crates/pdftract-core/tests/error_recovery_integration.rs- Contains
test_truncated_mid_stream()function (line 165) - Tests truncated streams with expected
STREAM_DECODE_ERRORdiagnostics - Uses
tests/error_recovery/fixtures/truncated_mid_stream.pdf
- Contains
-
crates/pdftract-core/tests/stream_decoder_fixtures.rs- Contains
flate_truncatedfixture test (line 61-65) - Tests flate decoder with truncated input
- Uses
tests/stream_decoder/fixtures/flate_truncated.bin
- Contains
Fixture files that exist:
-
tests/fixtures/malformed/truncated-flate.pdf(588 bytes)- This appears to be the PDF fixture that
test_truncated_flate_recovery.rswould test - Not currently referenced by any existing test
- This appears to be the PDF fixture that
-
tests/stream_decoder/fixtures/flate_truncated.bin- Binary fixture for stream decoder testing
- Has
.metafile: "FlateDecode: mid-stream EOF; expects partial bytes + STREAM_DECODE_ERROR" - Has
.expectedfile (1 line, minimal output)
Basic test structure understanding
From examining error_recovery_integration.rs and stream_decoder_fixtures.rs:
-
Error recovery test pattern:
- Load fixture with
fs::read() - Run extraction under
catch_unwindfor panic safety - Verify PDF starts with
%PDF- - Check for expected diagnostics
- Load fixture with
-
Stream decoder test pattern:
- Define fixture metadata (filter name, expected diagnostics, bomb limits)
- Load binary fixture
- Decode through appropriate decoder
- Compare against
.expectedfile
Existing test functions documented
error_recovery_integration.rs:
test_xref_30pct_bad_offsets()test_missing_mediabox_all_pages()test_missing_endobj()test_truncated_mid_stream()- most relevanttest_int_overflow_bbox()test_nested_failure()test_combined_failures()test_inv_8_no_panics_across_all_fixtures()
stream_decoder_fixtures.rs:
test_all_stream_decoder_fixtures()- includes flate_truncatedtest_each_filter_exercised()
Conclusion
The file test_truncated_flate_recovery.rs does not exist and needs to be created. The parent bead bf-4g6dj assumes this file exists, but it appears this is a new test file that should be created to test the specific truncated-flate.pdf fixture.
The test file should likely follow the pattern from error_recovery_integration.rs but specifically for testing the truncated-flate.pdf fixture and validating its extraction results and error diagnostics.