From 2df5c09242375ca29b7e95ac76de427c4f1518ed Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 26 Aug 2019 20:12:40 +0200 Subject: Tweak tests to avoid double compilation --- dhall/src/lib.rs | 1 - dhall/src/phase/mod.rs | 2 -- dhall/src/tests.rs | 7 +++++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dhall/src/lib.rs b/dhall/src/lib.rs index d40fbda..0a430e4 100644 --- a/dhall/src/lib.rs +++ b/dhall/src/lib.rs @@ -11,7 +11,6 @@ clippy::ptr_arg )] -#[cfg(test)] #[macro_use] mod tests; diff --git a/dhall/src/phase/mod.rs b/dhall/src/phase/mod.rs index ecf04e9..ed608df 100644 --- a/dhall/src/phase/mod.rs +++ b/dhall/src/phase/mod.rs @@ -119,7 +119,6 @@ impl Typed { self.0.normalize_mut() } - #[allow(dead_code)] pub(crate) fn get_type(&self) -> Result { Ok(self.0.get_type()?.into_typed()) } @@ -166,7 +165,6 @@ impl Normalized { pub(crate) fn to_expr(&self) -> NormalizedSubExpr { self.0.to_expr() } - #[allow(dead_code)] pub(crate) fn to_expr_alpha(&self) -> NormalizedSubExpr { self.0.to_expr_alpha() } diff --git a/dhall/src/tests.rs b/dhall/src/tests.rs index 8f16a12..074818a 100644 --- a/dhall/src/tests.rs +++ b/dhall/src/tests.rs @@ -1,3 +1,6 @@ +#[cfg(not(test))] +use assert_eq as assert_eq_pretty; +#[cfg(test)] use pretty_assertions::assert_eq as assert_eq_pretty; macro_rules! assert_eq_display { @@ -40,6 +43,7 @@ use std::path::PathBuf; use crate::error::{Error, Result}; use crate::phase::Parsed; +#[allow(dead_code)] #[derive(Copy, Clone)] pub enum Feature { Parser, @@ -53,6 +57,7 @@ pub enum Feature { TypeInference, } +#[allow(dead_code)] #[derive(Copy, Clone)] pub enum Status { Success, @@ -63,6 +68,7 @@ fn parse_file_str<'i>(file_path: &str) -> Result { Parsed::parse_file(&PathBuf::from(file_path)) } +#[allow(dead_code)] pub fn run_test_stringy_error( base_path: &str, feature: Feature, @@ -241,6 +247,7 @@ pub fn run_test( Ok(()) } +#[cfg(test)] mod spec { // See build.rs include!(concat!(env!("OUT_DIR"), "/spec_tests.rs")); -- cgit v1.2.3