Blob Blame History Raw
From 1612293b617f5459d2313c776d5117401c6aa8c2 Mon Sep 17 00:00:00 2001
From: Ryan Leckey <ryan@launchbadge.com>
Date: Tue, 25 Sep 2018 23:58:34 -0700
Subject: [PATCH] Fix #75; tests run with --no-default-features

---
 tests/datetime.rs   | 8 ++++++++
 tests/errors.rs     | 2 ++
 tests/file.rs       | 2 ++
 tests/file_hjson.rs | 2 ++
 tests/file_ini.rs   | 2 ++
 tests/file_json.rs  | 2 ++
 tests/file_toml.rs  | 2 ++
 tests/file_yaml.rs  | 2 ++
 tests/get.rs        | 2 ++
 tests/merge.rs      | 2 ++
 tests/set.rs        | 4 ++++
 11 files changed, 30 insertions(+)

diff --git a/tests/datetime.rs b/tests/datetime.rs
index f318f03..6c1e620 100644
--- a/tests/datetime.rs
+++ b/tests/datetime.rs
@@ -1,3 +1,11 @@
+#![cfg(all(
+    feature = "toml",
+    feature = "json",
+    feature = "hjson",
+    feature = "yaml",
+    feature = "ini",
+))]
+
 extern crate chrono;
 extern crate config;
 
diff --git a/tests/errors.rs b/tests/errors.rs
index 77a58ab..6bc674f 100644
--- a/tests/errors.rs
+++ b/tests/errors.rs
@@ -1,3 +1,5 @@
+#![cfg(feature = "toml")]
+
 extern crate config;
 
 use config::*;
diff --git a/tests/file.rs b/tests/file.rs
index c89d5da..0680c2a 100644
--- a/tests/file.rs
+++ b/tests/file.rs
@@ -1,3 +1,5 @@
+#![cfg(feature = "yaml")]
+
 extern crate config;
 
 use config::*;
diff --git a/tests/file_hjson.rs b/tests/file_hjson.rs
index 40c25cb..9c63ad6 100644
--- a/tests/file_hjson.rs
+++ b/tests/file_hjson.rs
@@ -1,3 +1,5 @@
+#![cfg(feature = "hjson")]
+
 extern crate config;
 extern crate float_cmp;
 extern crate serde;
diff --git a/tests/file_ini.rs b/tests/file_ini.rs
index 30d86a3..833cab0 100644
--- a/tests/file_ini.rs
+++ b/tests/file_ini.rs
@@ -1,3 +1,5 @@
+#![cfg(feature = "ini")]
+
 extern crate config;
 extern crate float_cmp;
 extern crate serde;
diff --git a/tests/file_json.rs b/tests/file_json.rs
index c07a77d..4b586b2 100644
--- a/tests/file_json.rs
+++ b/tests/file_json.rs
@@ -1,3 +1,5 @@
+#![cfg(feature = "json")]
+
 extern crate config;
 extern crate float_cmp;
 extern crate serde;
diff --git a/tests/file_toml.rs b/tests/file_toml.rs
index b1e70c0..0b5db4f 100644
--- a/tests/file_toml.rs
+++ b/tests/file_toml.rs
@@ -1,3 +1,5 @@
+#![cfg(feature = "toml")]
+
 extern crate config;
 extern crate float_cmp;
 extern crate serde;
diff --git a/tests/file_yaml.rs b/tests/file_yaml.rs
index 1d00d85..85788c4 100644
--- a/tests/file_yaml.rs
+++ b/tests/file_yaml.rs
@@ -1,3 +1,5 @@
+#![cfg(feature = "yaml")]
+
 extern crate config;
 extern crate float_cmp;
 extern crate serde;
diff --git a/tests/get.rs b/tests/get.rs
index 87f80a1..73eeeaf 100644
--- a/tests/get.rs
+++ b/tests/get.rs
@@ -1,3 +1,5 @@
+#![cfg(feature = "toml")]
+
 extern crate config;
 extern crate float_cmp;
 extern crate serde;
diff --git a/tests/merge.rs b/tests/merge.rs
index d6eb9e0..1be7db1 100644
--- a/tests/merge.rs
+++ b/tests/merge.rs
@@ -1,3 +1,5 @@
+#![cfg(feature = "toml")]
+
 extern crate config;
 
 use config::*;
diff --git a/tests/set.rs b/tests/set.rs
index e1f6290..bd439a0 100644
--- a/tests/set.rs
+++ b/tests/set.rs
@@ -11,6 +11,7 @@ fn test_set_scalar() {
     assert_eq!(c.get("value").ok(), Some(true));
 }
 
+#[cfg(feature = "toml")]
 #[test]
 fn test_set_scalar_default() {
     let mut c = Config::default();
@@ -25,6 +26,7 @@ fn test_set_scalar_default() {
     assert_eq!(c.get("staging").ok(), Some(false));
 }
 
+#[cfg(feature = "toml")]
 #[test]
 fn test_set_scalar_path() {
     let mut c = Config::default();
@@ -43,6 +45,7 @@ fn test_set_scalar_path() {
     assert_eq!(c.get("place.blocked").ok(), Some(true));
 }
 
+#[cfg(feature = "toml")]
 #[test]
 fn test_set_arr_path() {
     let mut c = Config::default();
@@ -74,6 +77,7 @@ fn test_set_arr_path() {
     assert_eq!(c.get("items[2]").ok(), Some("George".to_string()));
 }
 
+#[cfg(feature = "toml")]
 #[test]
 fn test_set_capital() {
     let mut c = Config::default();
-- 
2.19.0