From 5fc43f5ab5e84f09ad7aba6c856da16492153ef2 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Tue, 19 Oct 2021 15:41:29 +0100 Subject: [PATCH] add test --- actix-rt/tests/test-macro-import-conflict.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 actix-rt/tests/test-macro-import-conflict.rs diff --git a/actix-rt/tests/test-macro-import-conflict.rs b/actix-rt/tests/test-macro-import-conflict.rs new file mode 100644 index 00000000..c2c00b61 --- /dev/null +++ b/actix-rt/tests/test-macro-import-conflict.rs @@ -0,0 +1,15 @@ +//! 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]`). + +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; +}