Skip to content

Commit 7ff8df4

Browse files
Add more tests
1 parent 76c1dc2 commit 7ff8df4

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ quote = "1.0.36"
1717
proc-macro2 = "1.0.81"
1818
syn = { version = "2.0.59", features = ["full"] }
1919
unicode-ident = "1.0.12"
20+
21+
[dev-dependencies]
22+
tokio = { version = "1.45.0" , features = ["rt", "macros"]}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Multiple attributes can optionally be applied to each test, for example:
123123
test_each_file! { #[ignore, cfg(target_os = "linux")] in "./resources" => test }
124124
```
125125

126-
You can specify that each test is async, for example:
126+
You can specify that each test is async, in this case a test macro such as `#[tokio::test]` must be specified explicitly. For example:
127127

128128
```rust
129129
test_each_file! { #[tokio::test] async in "./resources" => test }
@@ -132,5 +132,5 @@ test_each_file! { #[tokio::test] async in "./resources" => test }
132132
All the options above can be combined, for example:
133133

134134
```rust
135-
test_each_file! { #[tokio::test, ignore, cfg(target_os = "linux")] async for ["in", "out"] in "./resources" as example => |[a, b]: [&str; 2]| assert_eq!(a, b) }
135+
test_each_file! { #[tokio::test, ignore, cfg(target_os = "linux")] async for ["in", "out"] in "./resources" as example => async |[a, b]: [&str; 2]| assert_eq!(a, b) }
136136
```

examples/readme/main.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,14 @@ mod tests {
6464

6565
test_each_file! { in "./examples/readme/duplicate_names/" => empty}
6666
}
67+
68+
mod attributes_async {
69+
use test_each_file::test_each_file;
70+
71+
async fn run(input: &str) {
72+
assert!(input.split_whitespace().all(|n| n.parse::<usize>().is_ok()));
73+
}
74+
75+
test_each_file! { #[tokio::test] async in "./examples/readme/resources_simple/" as simple => run }
76+
}
6777
}

0 commit comments

Comments
 (0)