From cdb4efe1b1ffd134c775e67e62918dc53542cd58 Mon Sep 17 00:00:00 2001 From: Jason Travis Smith Date: Thu, 12 Jan 2017 15:07:53 -0500 Subject: [PATCH] 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. --- examples/logger.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/examples/logger.rs b/examples/logger.rs index f332882..2e7b806 100644 --- a/examples/logger.rs +++ b/examples/logger.rs @@ -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 { 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