| Crates.io | parser-test-utils |
| lib.rs | parser-test-utils |
| version | 0.1.3 |
| created_at | 2025-03-21 03:24:50.728088+00 |
| updated_at | 2025-03-21 03:24:50.728088+00 |
| description | Test utilities for the parser project |
| homepage | |
| repository | https://github.com/excoffierleonard/parser |
| max_upload_size | |
| id | 1600056 |
| size | 348,043 |
Shared testing utilities and sample files for the Parser project ecosystem.
The assets directory contains sample files for testing:
.pdf).docx, .xlsx, .pptx).txt, .csv, .json).png, .jpg, .webp)All test files are small and contain known content for predictable testing.
Add as a dev-dependency in your crate's Cargo.toml:
[dev-dependencies]
parser-test-utils = { workspace = true }
Then use the utilities in your tests:
use parser_test_utils::{read_test_file, test_file_path};
#[test]
fn test_something() {
// Get path to a test file
let path = test_file_path("test_pdf_1.pdf");
// Or read a test file directly as bytes
let data = read_test_file("test_pdf_1.pdf");
// Use the file data in your tests...
}
test_file_path(filename) - Returns the absolute path to a test fileread_test_file(filename) - Reads a test file and returns its contents as Vec<u8>get_test_file_list() - Returns a list of all available test filescreate_temp_file(extension, content) - Creates a temporary test file with the given content