@@ -36,10 +36,15 @@ name = "<test target name>"
3636harness = false
3737````
3838
39- 2 . Call the ` datatest_stable::harness!(testfn, root, pattern) ` macro with the following
40- parameters:
39+ 2 . Call the ` datatest_stable::harness! ` macro as:
4140
42- * ` testfn ` - The test function to be executed on each matching input. This function can be one
41+ ```` rust,ignore
42+ datatest_stable::harness! {
43+ { test = my_test, root = "path/to/fixtures", pattern = r"^.*/*" },
44+ }
45+ ````
46+
47+ * ` test ` - The test function to be executed on each matching input. This function can be one
4348 of:
4449
4550 * ` fn(&Path) -> datatest_stable::Result<()> `
@@ -67,7 +72,13 @@ harness = false
6772 ` &str ` , or a function call that returns a ` String ` .
6873
6974The three parameters can be repeated if you have multiple sets of data-driven tests to be run:
70- ` datatest_stable::harness!(testfn1, root1, pattern1, testfn2, root2, pattern2) ` .
75+
76+ ```` rust,ignore
77+ datatest_stable::harness! {
78+ { test = testfn1, root = root1, pattern = pattern1 },
79+ { test = testfn2, root = root2, pattern = pattern2 },
80+ }
81+ ````
7182
7283### Relative paths
7384
@@ -101,10 +112,10 @@ fn my_test_utf8(path: &Utf8Path, contents: String) -> datatest_stable::Result<()
101112 Ok (())
102113}
103114
104- datatest_stable :: harness! (
105- my_test , " path/to/fixtures" , r " ^.*/*" ,
106- my_test_utf8 , " path/to/fixtures" , r " ^.*/*" ,
107- );
115+ datatest_stable :: harness! {
116+ { test = my_test , root = " path/to/fixtures" , pattern = r " ^.*/*" } ,
117+ { test = my_test_utf8 , root = " path/to/fixtures" , pattern = r " ^.*/*" } ,
118+ }
108119````
109120
110121If ` path/to/fixtures ` contains a file ` foo/bar.txt ` , then:
@@ -134,9 +145,9 @@ fn my_test(path: &Path, contents: Vec<u8>) -> datatest_stable::Result<()> {
134145 Ok (())
135146}
136147
137- datatest_stable :: harness! (
138- my_test , include_dir! (" tests/files" ), r " ^.*/*" ,
139- );
148+ datatest_stable :: harness! {
149+ { test = my_test , root = include_dir! (" tests/files" ), pattern = r " ^.*/*" } ,
150+ }
140151````
141152
142153You can also use directories published as ` static ` items in upstream crates:
@@ -153,9 +164,9 @@ fn my_test(path: &Utf8Path, contents: String) -> datatest_stable::Result<()> {
153164 Ok (())
154165}
155166
156- datatest_stable :: harness! (
157- my_test , & FIXTURES , r " ^.*/*" ,
158- );
167+ datatest_stable :: harness! {
168+ { test = my_test , root = & FIXTURES , pattern = r " ^.*/*" } ,
169+ }
159170````
160171
161172In this case, the passed-in ` Path ` and ` Utf8Path ` are ** relative** to the
@@ -186,9 +197,9 @@ fn my_test(path: &Utf8Path, contents: String) -> datatest_stable::Result<()> {
186197 Ok (())
187198}
188199
189- datatest_stable :: harness! (
190- my_test , & FIXTURES , r " ^.*/*" ,
191- );
200+ datatest_stable :: harness! {
201+ { test = my_test , root = & FIXTURES , pattern = r " ^.*/*" } ,
202+ }
192203````
193204
194205In this case, note that ` path ` will be relative to the ** crate directory**
0 commit comments