diff --git a/.appveyor.yml b/.appveyor.yml index 9058af8e..d7c0a90f 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -55,7 +55,7 @@ install: build: false test_script: - cargo build --verbose --all-features - - cargo test --verbose --features serde + - cargo test --all --verbose --features serde notifications: - provider: Email diff --git a/.travis.yml b/.travis.yml index 33fe56e6..533c396b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,7 @@ before_script: | script: | cargo build --verbose --all-features && - (test "$TRAVIS_RUST_VERSION" == "1.20.0" || cargo test --verbose --features serde) + (test "$TRAVIS_RUST_VERSION" == "1.20.0" || cargo test --all --verbose --features serde) after_success: | test "$TRAVIS_RUST_VERSION" != "stable" || cargo coveralls diff --git a/Cargo.toml b/Cargo.toml index 3ed5350b..a8e97d60 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,9 @@ travis-ci = { repository = "iliekturtles/uom" } coveralls = { repository = "iliekturtles/uom" } maintenance = { status = "actively-developed" } +[workspace] +members = ["tests/feature_check"] + [dependencies] num = "0.1" serde = { version = "1.0", optional = true, default-features = false } diff --git a/tests/feature_check/Cargo.toml b/tests/feature_check/Cargo.toml new file mode 100644 index 00000000..5229e13a --- /dev/null +++ b/tests/feature_check/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "feature_check" +version = "0.1.0" + +[dependencies] +uom = { path = "../.." } diff --git a/tests/feature_check/src/lib.rs b/tests/feature_check/src/lib.rs new file mode 100644 index 00000000..d3e89456 --- /dev/null +++ b/tests/feature_check/src/lib.rs @@ -0,0 +1,37 @@ +//! Validate that the feature_check crate has no `f32` feature and `storage_types!` still generates +//! code for the `f32` type. +//! +//! ``` +//! #[macro_use] +//! extern crate uom; +//! +//! #[cfg(feature = "f32")] +//! compile_error!("Unexpected feature `f32` in feature_check test crate."); +//! +//! storage_types! { +//! types: i32, f32; +//! +//! pub fn do_work(v: V) {} +//! } +//! +//! fn main() { +//! ::f32::do_work(1.0); +//! } +//! ``` +//! +//! Validate that `storage_types!` does not generate code for the `i32` type. +//! +//! ```rust,compile_fail +//! #[macro_use] +//! extern crate uom; +//! +//! storage_types! { +//! types: i32, f32; +//! +//! pub fn do_work(v: V) {} +//! } +//! +//! fn main() { +//! ::i32::do_work(1.0); +//! } +//! ```