Skip to content

Commit 1f06a0f

Browse files
committed
Add feature gates to test functions
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
1 parent 1712a47 commit 1f06a0f

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

tests/async_builder.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ impl AsyncSource for AsyncFile {
4646
}
4747
}
4848

49+
#[cfg(feature = "json")]
4950
#[tokio::test]
5051
async fn test_single_async_file_source() {
5152
let config = Config::builder()
@@ -60,6 +61,7 @@ async fn test_single_async_file_source() {
6061
assert_eq!(true, config.get::<bool>("debug").unwrap());
6162
}
6263

64+
#[cfg(all(feature = "json", feature = "toml"))]
6365
#[tokio::test]
6466
async fn test_two_async_file_sources() {
6567
let config = Config::builder()
@@ -80,6 +82,7 @@ async fn test_two_async_file_sources() {
8082
assert_eq!(1, config.get::<i32>("place.number").unwrap());
8183
}
8284

85+
#[cfg(all(feature = "toml", feature = "json"))]
8386
#[tokio::test]
8487
async fn test_sync_to_async_file_sources() {
8588
let config = Config::builder()
@@ -96,6 +99,7 @@ async fn test_sync_to_async_file_sources() {
9699
assert_eq!(1, config.get::<i32>("place.number").unwrap());
97100
}
98101

102+
#[cfg(all(feature = "toml", feature = "json"))]
99103
#[tokio::test]
100104
async fn test_async_to_sync_file_sources() {
101105
let config = Config::builder()
@@ -112,6 +116,7 @@ async fn test_async_to_sync_file_sources() {
112116
assert_eq!(1, config.get::<i32>("place.number").unwrap());
113117
}
114118

119+
#[cfg(feature = "toml")]
115120
#[tokio::test]
116121
async fn test_async_file_sources_with_defaults() {
117122
let config = Config::builder()
@@ -132,6 +137,7 @@ async fn test_async_file_sources_with_defaults() {
132137
assert_eq!(1, config.get::<i32>("place.number").unwrap());
133138
}
134139

140+
#[cfg(feature = "toml")]
135141
#[tokio::test]
136142
async fn test_async_file_sources_with_overrides() {
137143
let config = Config::builder()

tests/legacy/set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn test_set_arr_path() {
7777
assert_eq!(c.get("items[2]").ok(), Some("George".to_string()));
7878
}
7979

80-
#[cfg(feature = "toml")]
80+
#[cfg(feature = "json")]
8181
#[test]
8282
fn test_set_capital() {
8383
let mut c = Config::default();

tests/set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fn test_set_arr_path() {
7575
assert_eq!(config.get("items[2]").ok(), Some("George".to_string()));
7676
}
7777

78-
#[cfg(feature = "toml")]
78+
#[cfg(feature = "json")]
7979
#[test]
8080
fn test_set_capital() {
8181
let config = Config::builder()

0 commit comments

Comments
 (0)