wtest_basic/basic/helper.rs
1
2//!
3//! Helpers.
4//!
5
6/// Internal namespace.
7pub( crate ) mod private
8{
9
10 // zzz : move here test tools
11
12 // /// Pass only if callback fails either returning error or panicing.
13 //
14 // pub fn should_throw< R, F : FnOnce() -> anyhow::Result< R > >( f : F ) -> anyhow::Result< R >
15 // {
16 // f()
17 // }
18
19 //
20
21 // #[panic_handler]
22 // fn panic( info : &core::panic::PanicInfo ) -> !
23 // {
24 // println!( "{:?}", info );
25 // loop {}
26 // }
27
28 // pub use test_suite;
29 // pub use test_suite_internals;
30 // pub use index;
31
32 ///
33 /// Required to convert integets to floats.
34 ///
35
36 #[ macro_export ]
37 macro_rules! num
38 {
39
40 () =>
41 {
42 };
43
44 ( $num : expr ) =>
45 {
46 num_traits::cast::< _, T >( $num ).unwrap()
47 };
48
49 ( $( $num : expr ),+ ) =>
50 {(
51 $( num_traits::cast::< _, T >( $num ).unwrap() ),+
52 )};
53
54 }
55
56 ///
57 /// Test a file with documentation.
58 ///
59
60 #[ macro_export ]
61 macro_rules! doc_file_test
62 {
63 ( $file:expr ) =>
64 {
65 #[ allow( unused_doc_comments ) ]
66 #[ cfg( doctest ) ]
67 #[ doc = include_str!( concat!( env!( "CARGO_MANIFEST_DIR" ), "/", $file ) ) ]
68 extern { }
69 };
70 }
71
72 pub use num;
73 pub use doc_file_test;
74}
75
76//
77
78meta_tools::mod_interface!
79{
80 prelude use
81 {
82 num,
83 doc_file_test,
84 };
85}