Crates.io | testdata |
lib.rs | testdata |
version | 0.1.0 |
source | src |
created_at | 2022-09-25 10:13:36.645856 |
updated_at | 2022-09-25 10:13:36.645856 |
description | File-based testing helper |
homepage | |
repository | https://github.com/qnighy/testdata-rs |
max_upload_size | |
id | 673532 |
size | 3,639 |
Macros and helper functions for file-based testing.
The crate's main feature is [testdata::files
], which automatically
finds test files and expands to multiple tests.
use std::str;
use testdata::{assert_snapshot, TestFile};
#[testdata::files(rebuild = "tests/example.rs")]
#[test]
fn test_foo(
#[glob = "tests/fixtures/**/*-in.txt"] input: &TestFile,
#[glob = "tests/fixtures/**/*-out.txt"] output: &TestFile,
) {
let s = input.raw_read();
let s = str::from_utf8(&s).unwrap();
let result = s.to_uppercase();
assert_snapshot!(result, snapshot = output);
}
More documents will be added in the later versions.