Skip to content

Commit 84c2fed

Browse files
ibraheemdevtaiki-e
authored andcommitted
apply suggestions from code review
1 parent 08a9aa3 commit 84c2fed

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

futures-test/src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,17 @@ mod track_closed;
6161
/// assert!(fut.await);
6262
/// }
6363
/// ```
64+
///
65+
/// This is equivalent to the following code:
66+
///
67+
/// ```
68+
/// #[test]
69+
/// fn my_test() {
70+
/// futures::executor::block_on(async move {
71+
/// let fut = async { true };
72+
/// assert!(fut.await);
73+
/// })
74+
/// }
75+
/// ```
6476
#[cfg(feature = "std")]
6577
pub use futures_macro::test_internal as test;

futures/tests/test_macro.rs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
#[cfg(test)]
2-
mod tests {
3-
#[futures_test::test]
4-
async fn it_works() {
5-
let fut = async { true };
6-
assert!(fut.await);
1+
#[futures_test::test]
2+
async fn it_works() {
3+
let fut = async { true };
4+
assert!(fut.await);
75

8-
let fut = async { false };
9-
assert!(!fut.await);
10-
}
6+
let fut = async { false };
7+
assert!(!fut.await);
8+
}
119

12-
#[futures_test::test]
13-
#[should_panic]
14-
async fn it_is_being_run() {
15-
let fut = async { false };
16-
assert!(fut.await);
17-
}
10+
#[should_panic]
11+
#[futures_test::test]
12+
async fn it_is_being_run() {
13+
let fut = async { false };
14+
assert!(fut.await);
1815
}

0 commit comments

Comments
 (0)