ntest_proc_macro_helper-0.8.0/Cargo.toml0000644000000017160000000000100137440ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2018" name = "ntest_proc_macro_helper" version = "0.8.0" authors = ["Armin Becher "] description = "Provide helper functions for the procedural macros used in ntest." documentation = "https://docs.rs/ntest" readme = "README.md" keywords = [ "test", "tests", "unit", "testing", ] categories = [ "development-tools", "development-tools::testing", ] license = "MIT" repository = "https://github.com/becheran/ntest" [lib] path = "src/lib.rs" ntest_proc_macro_helper-0.8.0/Cargo.toml.orig000064400000000000000000000007620072674642500174550ustar 00000000000000[package] name = "ntest_proc_macro_helper" version = "0.8.0" authors = [ "Armin Becher ",] edition = "2018" description = "Provide helper functions for the procedural macros used in ntest." keywords = [ "test", "tests", "unit", "testing",] categories = [ "development-tools", "development-tools::testing",] readme = "README.md" license = "MIT" repository = "https://github.com/becheran/ntest" documentation = "https://docs.rs/ntest" [lib] path = "src/lib.rs" ntest_proc_macro_helper-0.8.0/LICENSE000064400000000000000000000021000072674642500155570ustar 00000000000000MIT License Copyright (c) 2019 Armin Becher Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.ntest_proc_macro_helper-0.8.0/README.md000064400000000000000000000003140072674642500160360ustar 00000000000000# NTest Procedural Macro Helper Part of the [NTest library](https://crates.io/crates/ntest). Only a helper lib for the [procedural macros](https://doc.rust-lang.org/reference/procedural-macros.html). ntest_proc_macro_helper-0.8.0/src/lib.rs000064400000000000000000000011350072674642500164640ustar 00000000000000//! The ntest lib enhances the rust test framework with some useful functions. use std::sync::mpsc; use std::thread; use std::time::Duration; #[doc(hidden)] /// Timeout helper for proc macro timeout pub fn execute_with_timeout( code: &'static (dyn Fn() -> T + Sync + 'static), timeout_ms: u64, ) -> Option { let (sender, receiver) = mpsc::channel(); thread::spawn(move || { if let Ok(()) = sender.send(code()) {} }); match receiver.recv_timeout(Duration::from_millis(timeout_ms)) { Ok(t) => Some(t), Err(_) => None, } }