-
-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Problem
The current README provides a good overview of how to set up and use datatest-stable
, but it lacks a practical example involving a custom test function that takes multiple types of inputs (e.g., both a Path
and file contents).
Suggested Improvement
It would be helpful to include an example that demonstrates how to define a custom test function that takes both a Path
and a String
(or Vec<u8>
). For instance, an example function could show how to validate data from the file fixture and the file's path together. This would enhance understanding for users who wish to leverage both parameters in their tests.
Example Code
Here’s a potential addition to the README:
fn my_custom_test(path: &Path, contents: String) -> datatest_stable::Result<()> {
// Implement your test logic here, for example:
assert!(contents.len() > 0, "File at {:?} should not be empty", path);
// Further testing logic...
}
datatest_stable::harness! {
{ test = my_custom_test, root = "path/to/fixtures", pattern = r".*\.txt" },
}
Including this example in the README would likely assist users in understanding the versatility of the datatest-stable
framework.