Now correctly tests not using the Rust standard library.

Added the ability to correctly create a TestLogger when not
using the standard library. This was done by creating a constant
TestLogger and a set_logger function that returned a constant pointer
to the constant logger.
This commit is contained in:
Myrddin Dundragon 2017-01-12 15:07:53 -05:00
parent eb03b1a1ea
commit cdb4efe1b1

View File

@ -7,6 +7,11 @@ use scribe::{Levels, Logger, Record};
#[cfg(not(feature="use_std"))]
const core_logger: TestLogger = TestLogger {};
pub struct TestLogger
{
}
@ -45,6 +50,7 @@ impl TestLogger
}
}
#[cfg(feature="use_std")]
fn set_logger() -> Box<Logger>
{
let logger: TestLogger;
@ -56,6 +62,12 @@ impl TestLogger
Box::new(logger)
}
#[cfg(not(feature="use_std"))]
fn set_logger() -> *const Logger
{
&core_logger
}
}
impl Logger for TestLogger