@@ -29,9 +29,10 @@ harness = false
29
29
30
30
2 . Call the ` datatest_stable::harness!(testfn, root, pattern) ` macro with the following
31
31
parameters:
32
- * ` testfn ` - The test function to be executed on each matching input. This function must have
33
- the type ` fn(&Utf8Path) -> datatest_stable::Result<()> ` . (` Utf8Path ` is part of the
34
- [ ` camino ` ] ( https://docs.rs/camino ) library.)
32
+ * ` testfn ` - The test function to be executed on each matching input. This function can be one of:
33
+ * ` fn(&Path) -> datatest_stable::Result<()> `
34
+ * ` fn(&Utf8Path) -> datatest_stable::Result<()> ` (` Utf8Path ` is part of the
35
+ [ ` camino ` ] ( https://docs.rs/camino ) library, and is re-exported here for convenience.)
35
36
* ` root ` - The path to the root directory where the input files (fixtures) live. This path is
36
37
relative to the root of the crate.
37
38
* ` pattern ` - the regex used to match against and select each file to be tested.
@@ -45,14 +46,24 @@ This is an example test. Use it with `harness = false`.
45
46
46
47
``` rust
47
48
use datatest_stable :: Utf8Path ;
49
+ use std :: path :: Path ;
48
50
49
- fn my_test (path : & Utf8Path ) -> datatest_stable :: Result <()> {
51
+ fn my_test (path : & Path ) -> datatest_stable :: Result <()> {
50
52
// ... write test here
51
53
52
54
Ok (())
53
55
}
54
56
55
- datatest_stable :: harness! (my_test , " path/to/fixtures" , r " ^.*/*" );
57
+ fn my_test_utf8 (path : & Utf8Path ) -> datatest_stable :: Result <()> {
58
+ // ... write test here
59
+
60
+ Ok (())
61
+ }
62
+
63
+ datatest_stable :: harness! (
64
+ my_test , " path/to/fixtures" , r " ^.*/*" ,
65
+ my_test_utf8 , " path/to/fixtures" , r " ^.*/*,
66
+ );
56
67
```
57
68
58
69
## Minimum supported Rust version (MSRV)
0 commit comments