Skip to content

Commit

Permalink
chore: Test async_fn_in_trait in new feature nightly-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
audunhalland committed Dec 9, 2022
1 parent f236d5a commit 2b3661b
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v3
- uses: taiki-e/install-action@cargo-hack
- name: Test feature powerset
run: cargo hack --feature-powerset --optional-deps "unimock" --exclude-features "default use-associated-futures" --exclude-no-default-features test
run: cargo hack --feature-powerset --exclude-features "default use-associated-futures nightly-tests" --exclude-no-default-features test
- name: Test workspace
run: cargo test --workspace --features "boxed-futures"
- name: Doctest
Expand All @@ -31,4 +31,4 @@ jobs:
- uses: dtolnay/rust-toolchain@nightly
- uses: taiki-e/install-action@cargo-hack
- name: Test nightly features
run: cargo hack --feature-powerset --optional-deps "unimock" --exclude-features "default boxed-futures use-boxed-futures" --exclude-no-default-features test
run: cargo hack --feature-powerset --exclude-features "default boxed-futures use-boxed-futures" --exclude-no-default-features test
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ unimock = ["dep:unimock"]
use-boxed-futures = ["boxed-futures"]
use-associated-futures = []
boxed-futures = ["dep:async-trait"]
nightly-tests = []

[dependencies]
entrait_macros = { path = "entrait_macros", version = "0.5.0-alpha.1" }
Expand Down
2 changes: 1 addition & 1 deletion test_all_stable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
set -e
set -x

cargo hack --feature-powerset --optional-deps "unimock" --exclude-features "default use-associated-futures" --exclude-no-default-features test
cargo hack --feature-powerset --exclude-features "default use-associated-futures nightly-tests" --exclude-no-default-features test
cargo test --workspace --features "unimock use-boxed-futures"
cargo test --doc --features "unimock use-boxed-futures"
2 changes: 1 addition & 1 deletion tests/it/dependency_inversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ mod simple_dyn {
}
}

#[cfg(any(feature = "use-boxed-futures", feature = "use-associated-futures"))]
#[cfg(feature = "nightly-tests")]
mod async_static {
use entrait::*;

Expand Down
13 changes: 12 additions & 1 deletion tests/it/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
#![allow(dead_code)]
#![allow(unused)]
#![allow(clippy::blacklisted_name)]
#![cfg_attr(feature = "use-associated-futures", feature(type_alias_impl_trait))]
#![cfg_attr(
any(feature = "nightly-tests", feature = "use-associated-futures"),
feature(type_alias_impl_trait)
)]
#![cfg_attr(
any(feature = "nightly-tests", feature = "use-associated-futures"),
feature(async_fn_in_trait)
)]
#![cfg_attr(
any(feature = "nightly-tests", feature = "use-associated-futures"),
feature(closure_track_caller)
)]

mod delegation_modes;
mod dependency_inversion;
Expand Down
6 changes: 5 additions & 1 deletion tests/it/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ mod bounds {
}
}

#[cfg(any(feature = "use-boxed-futures", feature = "use-associated-futures"))]
#[cfg(any(
feature = "use-boxed-futures",
feature = "use-associated-futures",
feature = "nightly-tests"
))]
mod no_deps_and_feign {
use entrait::entrait;

Expand Down
33 changes: 28 additions & 5 deletions tests/it/unimock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ mod sync {
}
}

#[cfg(any(feature = "use-boxed-futures", feature = "use-associated-futures"))]
#[cfg(any(
feature = "use-boxed-futures",
feature = "use-associated-futures",
feature = "nightly-tests"
))]
mod auth {
use entrait::*;
use unimock::*;
Expand Down Expand Up @@ -117,7 +121,11 @@ mod auth {
}
}

#[cfg(any(feature = "use-boxed-futures", feature = "use-associated-futures"))]
#[cfg(any(
feature = "use-boxed-futures",
feature = "use-associated-futures",
feature = "nightly-tests"
))]
mod multi_mock {
use entrait::*;
use unimock::*;
Expand Down Expand Up @@ -200,6 +208,9 @@ mod multi_mock {
}
}

/// Note: This test does not run under "nightly-tests",
/// because it uses tokio::spawn, and there is currently
/// no way to Send-bound futures from plain async fns in traits.
#[cfg(any(feature = "use-boxed-futures", feature = "use-associated-futures"))]
mod tokio_spawn {
use entrait::*;
Expand Down Expand Up @@ -249,7 +260,11 @@ mod tokio_spawn {
}
}

#[cfg(any(feature = "use-boxed-futures", feature = "use-associated-futures"))]
#[cfg(any(
feature = "use-boxed-futures",
feature = "use-associated-futures",
feature = "nightly-tests"
))]
mod more_async {
use entrait::*;
use unimock::*;
Expand Down Expand Up @@ -290,7 +305,11 @@ mod more_async {
}
}

#[cfg(any(feature = "use-boxed-futures", feature = "use-associated-futures"))]
#[cfg(any(
feature = "use-boxed-futures",
feature = "use-associated-futures",
feature = "nightly-tests"
))]
mod async_no_deps_etc {
use entrait::*;
use unimock::*;
Expand Down Expand Up @@ -521,7 +540,11 @@ mod module {
}
}

#[cfg(any(feature = "use-boxed-futures", feature = "use-associated-futures"))]
#[cfg(any(
feature = "use-boxed-futures",
feature = "use-associated-futures",
feature = "nightly-tests"
))]
mod module_async {
use entrait::*;

Expand Down

0 comments on commit 2b3661b

Please sign in to comment.