1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/// Generate a series of tests that receive file contents as strings,
/// based on the result of a glob pattern.
///
/// This excludes any matched directories.
///
/// # Usage
/// ```rust
/// #[test_each::file(glob = "data/*.txt")]
/// fn test_file(content: &str) {
/// // test contents
/// }
/// ```
///
/// Add a second parameter that implements [`AsRef`](std::convert::AsRef)
/// for [`Path`](std::path::Path) to receive the path of the file.
/// ```rust
/// #[test_each::file("data/*.txt")]
/// fn test_file(content: &str, path: &Path) {
/// // test contents
/// }
/// ```
///
/// ## Customizing the function name
///
/// Use `name(segments = <n>)` to use up to `n` path segments in the generated function name.
///
/// Use `name(extension)` to include the file extension in the generated function name.
///
/// Use `name(index)` to include a unique index in the generated function name.
///
/// ```rust
/// #[test_each::file("data/*.txt", name(segments = 2, extension, index))]
/// fn test_file(_: &str) { }
/// ```
pub use test_each_file as file;
/// Generate a series of tests that receive file contents as byte slices,
/// based on the result of a glob pattern.
///
/// This excludes any matched directories.
///
/// # Usage
/// ```rust
/// #[test_each::blob("data/*.bin")]
/// fn test_bytes(content: &[u8]) {
/// // test contents
/// }
/// ```
///
/// Add a second parameter that implements [`AsRef`](std::convert::AsRef)
/// for [`Path`](std::path::Path) to receive the path of the file.
/// ```rust
/// #[test_each::blob("data/*.bin")]
/// fn test_bytes(content: &[u8], path: &Path) {
/// // test contents
/// }
/// ```
///
/// ## Customizing the function name
///
/// Use `name(segments = <n>)` to use up to `n` path segments in the generated function name.
///
/// Use `name(extension)` to include the file extension in the generated function name.
///
/// Use `name(index)` to include a unique index in the generated function name.
///
/// ```rust
/// #[test_each::blob("data/*.txt", name(segments = 2, extension, index))]
/// fn test_file(_: &[u8]) { }
/// ```
pub use test_each_blob as blob;
/// Generate a series of tests that receive file paths,
/// based on the result of a glob pattern.
///
/// This includes any matched directories.
///
/// # Usage
/// ```rust
/// #[test_each::path("data/*")]
/// fn test_paths(path: &Path) {
/// // test contents
/// }
/// ```
///
/// ## Customizing the function name
///
/// Use `name(segments = <n>)` to use up to `n` path segments in the generated function name.
///
/// Use `name(extension)` to include the file extension in the generated function name.
///
/// Use `name(index)` to include a unique index in the generated function name.
///
/// ```rust
/// #[test_each::path("data/*.txt", name(segments = 2, extension, index))]
/// fn test_file(_: &Path) { }
/// ```
pub use test_each_path as path;