1
+ <!-- cargo-sync-rdme title [[ -->
1
2
# datatest-stable
2
-
3
- [ ![ datatest-stable on crates.io] ( https://img.shields.io/crates/v/datatest-stable )] ( https://crates.io/crates/datatest-stable )
4
- [ ![ Documentation (latest release)] ( https://img.shields.io/badge/docs-latest-brightgreen )] ( https://docs.rs/datatest-stable/ )
5
- [ ![ Documentation (main)] ( https://img.shields.io/badge/docs-main-purple )] ( https://datatest-stable.nexte.st/ )
6
- [ ![ License] ( https://img.shields.io/badge/license-Apache-green.svg )] ( ../LICENSE-APACHE )
7
- [ ![ License] ( https://img.shields.io/badge/license-MIT-green.svg )] ( ../LICENSE-MIT )
8
-
3
+ <!-- cargo-sync-rdme ]] -->
4
+ <!-- cargo-sync-rdme badge [[ -->
5
+ [ ![ Maintenance: passively-maintained] ( https://img.shields.io/badge/maintenance-passively--maintained-yellowgreen.svg? )] ( https://doc.rust-lang.org/cargo/reference/manifest.html#the-badges-section )
6
+ ![ License: MIT OR Apache-2.0] ( https://img.shields.io/crates/l/datatest-stable.svg? )
7
+ [ ![ crates.io] ( https://img.shields.io/crates/v/datatest-stable.svg?logo=rust )] ( https://crates.io/crates/datatest-stable )
8
+ [ ![ docs.rs] ( https://img.shields.io/docsrs/datatest-stable.svg?logo=docs.rs )] ( https://docs.rs/datatest-stable )
9
+ [ ![ Rust: ^1.72.0] ( https://img.shields.io/badge/rust-^1.72.0-93450a.svg?logo=rust )] ( https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field )
10
+ <!-- cargo-sync-rdme ]] -->
11
+ <!-- cargo-sync-rdme rustdoc [[ -->
9
12
` datatest-stable ` is a test harness intended to write * file-driven* or * data-driven* tests,
10
13
where individual test cases are specified as files and not as code.
11
14
@@ -24,11 +27,11 @@ organization](https://github.com/nextest-rs/) on GitHub.
24
27
25
28
1 . Configure the test target by setting ` harness = false ` in ` Cargo.toml ` :
26
29
27
- ``` toml
30
+ ```` toml
28
31
[[test ]]
29
32
name = " <test target name>"
30
33
harness = false
31
- ```
34
+ ````
32
35
33
36
2 . Call the ` datatest_stable::harness!(testfn, root, pattern) ` macro with the following
34
37
parameters:
@@ -37,15 +40,15 @@ harness = false
37
40
of:
38
41
* ` fn(&Path) -> datatest_stable::Result<()> `
39
42
* ` fn(&Utf8Path) -> datatest_stable::Result<()> ` (` Utf8Path ` is part of the
40
- [ ` camino ` ] ( https://docs.rs/camino ) library, and is re-exported here for convenience.)
43
+ [ ` camino ` ] ( https://docs.rs/camino ) library, and is re-exported here for convenience.)
41
44
* ` fn(&P, String) -> datatest_stable::Result<()> ` where ` P ` is ` Path ` or ` Utf8Path ` . If the
42
45
extra ` String ` parameter is specified, the contents of the file will be loaded and passed in
43
46
as a string (erroring out if that failed).
44
47
* ` fn(&P, Vec<u8>) -> datatest_stable::Result<()> ` where ` P ` is ` Path ` or ` Utf8Path ` . If the
45
48
extra ` Vec<u8> ` parameter is specified, the contents of the file will be loaded and passed
46
49
in as a ` Vec<u8> ` (erroring out if that failed).
47
50
* ` root ` - The path to the root directory where the input files (fixtures) live. This path is
48
- relative to the root of the crate (the directory where the crate' s ` Cargo.toml ` is located).
51
+ relative to the root of the crate (the directory where the crate’ s ` Cargo.toml ` is located).
49
52
* ` pattern ` - a regex used to match against and select each file to be tested. Extended regexes
50
53
with lookaround and backtracking are supported via the
51
54
[ ` fancy_regex ` ] ( https://docs.rs/fancy-regex ) crate.
@@ -57,7 +60,7 @@ The three parameters can be repeated if you have multiple sets of data-driven te
57
60
58
61
This is an example test. Use it with ` harness = false ` .
59
62
60
- ``` rust
63
+ ```` rust
61
64
use datatest_stable :: Utf8Path ;
62
65
use std :: path :: Path ;
63
66
@@ -77,7 +80,7 @@ datatest_stable::harness!(
77
80
my_test , " path/to/fixtures" , r " ^.*/*" ,
78
81
my_test_utf8 , " path/to/fixtures" , r " ^.*/*" ,
79
82
);
80
- ```
83
+ ````
81
84
82
85
## Minimum supported Rust version (MSRV)
83
86
@@ -89,15 +92,9 @@ version update; at any time, Rust versions from at least the last 6 months are s
89
92
* [ ` datatest ` ] ( https://crates.io/crates/datatest ) : the original inspiration for this crate, with
90
93
more features but targeting nightly Rust.
91
94
* [ Data-driven testing] ( https://en.wikipedia.org/wiki/Data-driven_testing )
95
+ <!-- cargo-sync-rdme ]] -->
92
96
93
97
## License
94
98
95
99
This project is available under the terms of either the [ Apache 2.0 license] ( LICENSE-APACHE ) or the [ MIT
96
100
license] ( LICENSE-MIT ) .
97
-
98
- <!--
99
- README.md is generated from README.tpl by cargo readme. To regenerate:
100
-
101
- cargo install cargo-readme
102
- ./scripts/regenerate-readmes.sh
103
- -->
0 commit comments