diff options
author | HampusM <hampus@hampusmat.com> | 2022-10-09 20:41:09 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-10-09 20:42:07 +0200 |
commit | fd5b6786d29d056ff0721a59435b50005f13f05c (patch) | |
tree | 3839ff2ffa99a14d1aefb952a55f1cb05aa0f09e /src/castable_factory/threadsafe.rs | |
parent | 5b0c6a52022e67a2d9cee251b3d08b9cb2b5f6cb (diff) |
test: add more unit tests
Diffstat (limited to 'src/castable_factory/threadsafe.rs')
-rw-r--r-- | src/castable_factory/threadsafe.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/castable_factory/threadsafe.rs b/src/castable_factory/threadsafe.rs index 08c5ecf..84e15b9 100644 --- a/src/castable_factory/threadsafe.rs +++ b/src/castable_factory/threadsafe.rs @@ -85,3 +85,27 @@ where ReturnInterface: 'static + ?Sized, { } + +#[cfg(test)] +mod tests +{ + use super::*; + + #[test] + fn can_call() + { + #[derive(Debug, PartialEq, Eq)] + struct Bacon + { + heal_amount: u32, + } + + let castable_factory = ThreadsafeCastableFactory::new(&|heal_amount| { + TransientPtr::new(Bacon { heal_amount }) + }); + + let output = castable_factory(27); + + assert_eq!(output, Box::new(Bacon { heal_amount: 27 })); + } +} |