1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-27 01:37:42 +02:00

fix test macro in presence of other imports named test (#399)

This commit is contained in:
Rob Ede
2021-10-19 16:13:13 +01:00
committed by GitHub
parent ca77d8d835
commit 47f278b17a
8 changed files with 31 additions and 5 deletions

View File

@ -23,7 +23,7 @@ macros = ["actix-macros"]
io-uring = ["tokio-uring"]
[dependencies]
actix-macros = { version = "0.2.0", optional = true }
actix-macros = { version = "0.2.3", optional = true }
futures-core = { version = "0.3", default-features = false }
tokio = { version = "1.5.1", features = ["rt", "net", "parking_lot", "signal", "sync", "time"] }

View File

@ -0,0 +1,17 @@
//! Checks that test macro does not cause problems in the presence of imports named "test" that
//! could be either a module with test items or the "test with runtime" macro itself.
//!
//! Before actix/actix-net#399 was implemented, this macro was running twice. The first run output
//! `#[test]` and it got run again and since it was in scope.
//!
//! Prevented by using the fully-qualified test marker (`#[::core::prelude::v1::test]`).
#![cfg(feature = "macros")]
use actix_rt::time as test;
#[actix_rt::test]
async fn test_naming_conflict() {
use test as time;
time::sleep(std::time::Duration::from_millis(2)).await;
}