-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(maitake-sync): test futures impl
Future
(#518)
Depends on #517 As described in #516, this commit adds tests ensuring that `Future` impls are always present for sync primitive future types when using user-provided `ScopedRawMutex`/`RawMutex` impls. This should help protect against future regressions. Fixes #516
- Loading branch information
Showing
8 changed files
with
102 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
use super::*; | ||
use crate::util::test::{assert_future, NopRawMutex}; | ||
#[cfg(all(not(loom), feature = "alloc"))] | ||
mod alloc_tests; | ||
#[cfg(any(loom, feature = "alloc"))] | ||
mod loom; | ||
|
||
#[test] | ||
fn wait_future_is_future() { | ||
// WaitMap with default mutex. | ||
assert_future::<Wait<'_, i32, i32>>(); | ||
|
||
// WaitMap with overridden `ScopedRawMutex`. | ||
assert_future::<Wait<'_, i32, i32, NopRawMutex>>(); | ||
} | ||
|
||
#[test] | ||
fn subscribe_future_is_future() { | ||
// WaitMap with default mutex. | ||
assert_future::<Subscribe<'_, '_, i32, i32>>(); | ||
|
||
// WaitMap with overridden `ScopedRawMutex`. | ||
assert_future::<Subscribe<'_, '_, i32, i32, NopRawMutex>>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
#[cfg(any(loom, feature = "alloc"))] | ||
use super::*; | ||
use crate::util::test::{assert_future, NopRawMutex}; | ||
|
||
#[cfg(all(not(loom), feature = "alloc"))] | ||
mod alloc_tests; | ||
|
||
#[cfg(any(loom, feature = "alloc"))] | ||
mod loom; | ||
|
||
#[test] | ||
fn wait_future_is_future() { | ||
// WaitQueue with default raw mutex | ||
assert_future::<Wait<'_>>(); | ||
// WaitQueue with overridden raw mutex | ||
assert_future::<Wait<'_, NopRawMutex>>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters