oysterpack_testing 0.1.0

Standardizes logging for the OysterPack platform
Documentation

This crate is meant to be used as a dev dependency. Its purpose is to provides the testing support to help reduce boilerplate, duplication, and provides standardization.

The following macros are provided:

  • op_tests_mod
    • provides support to configure logging for tests
    • logs test execution time
  • op_tests
    • used to generate test functions that leverage the tests module generated by op_tests_mod!()

Example


#[cfg(test)]
#[macro_use]
extern crate oysterpack_testing;

#[cfg(test)]
op_tests_mod!();

#[cfg(test)]
mod foo_test {
   op_test!(foo, {
     info!("SUCCESS");
   });
}

Example - configuring target log levels


#[cfg(test)]
#[macro_use]
extern crate oysterpack_testing;

#[cfg(test)]
op_tests_mod! {
    "foo" => Info,
    "bar" => Error
}

#[cfg(test)]
mod foo_test {
   op_test!(foo, {
        info!("tests_op_test passed !!!");
        info!(target: "foo", "foo info");
        info!(target: "bar", "*** bar info should not be logged ***");
        error!(target: "bar", "bar error");
   });
}