Skip to content

Commit 504681d

Browse files
committed
tests: Compile with no features
1 parent 5b9cab5 commit 504681d

File tree

11 files changed

+25
-3
lines changed

11 files changed

+25
-3
lines changed

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,5 +150,9 @@ notify = "6.0"
150150
temp-env = "0.3"
151151
log = { version = "0.4", features = ["serde"] }
152152

153+
[[example]]
154+
name = "async_source"
155+
required-features = ["json", "async"]
156+
153157
[lints]
154158
workspace = true

examples/custom_file_format/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use config::{Config, File, FileStoredFormat, Format, Map, Value, ValueKind};
22
use std::io::{Error, ErrorKind};
33

44
/// The private and public key sources will be read into their associated variable:
5-
#[derive(serde::Deserialize, Clone, Debug)]
5+
#[derive(serde_derive::Deserialize, Clone, Debug)]
66
pub struct Settings {
77
pub private_key: Option<String>,
88
pub public_key: Option<String>,

src/ser.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,8 @@ impl ser::SerializeStructVariant for Unreachable {
678678
mod test {
679679
use super::*;
680680
use serde::{Deserialize, Serialize};
681+
#[cfg(not(feature = "json5"))]
682+
use serde_derive::{Deserialize, Serialize};
681683

682684
#[test]
683685
fn test_struct() {
@@ -698,6 +700,7 @@ mod test {
698700
}
699701

700702
#[test]
703+
#[cfg(feature = "json")]
701704
fn test_nest() {
702705
let val = serde_json::json! { {
703706
"top": {

src/value.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,7 @@ mod tests {
888888
use crate::FileFormat;
889889

890890
#[test]
891+
#[cfg(feature = "toml")]
891892
fn test_i64() {
892893
let c = Config::builder()
893894
.add_source(File::new("tests/types/i64.toml", FileFormat::Toml))

tests/async_builder.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#![cfg(feature = "async")]
2+
#![cfg(feature = "json")]
3+
14
use async_trait::async_trait;
25
use config::{AsyncSource, Config, ConfigError, FileFormat, Format, Map, Value};
36
use std::{env, fs, path, str::FromStr};

tests/env.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ fn test_parse_string_and_list_ignore_list_parse_key_case() {
522522
}
523523

524524
#[test]
525+
#[cfg(feature = "convert-case")]
525526
fn test_parse_nested_kebab() {
526527
use config::Case;
527528

tests/integer_range.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg(feature = "toml")]
2+
13
use config::Config;
24

35
#[test]

tests/log.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg(feature = "json")]
2+
13
#[macro_use]
24
extern crate serde_derive;
35

@@ -33,6 +35,7 @@ fn test_case_sensitivity_log_level_from_str() {
3335
}
3436

3537
#[test]
38+
#[cfg(feature = "json")]
3639
fn test_case_sensitivity_json_from_str() {
3740
// to confirm serde_json works as expected
3841
let s = r#"{ "log": "error" }"#;

tests/ron_enum.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg(feature = "ron")]
2+
13
use config::{Config, File, FileFormat};
24
use serde_derive::Deserialize;
35

tests/unsigned_int_hm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#![cfg(not(feature = "preserve_order"))]
22

3-
#[derive(serde::Deserialize, Eq, PartialEq, Debug)]
3+
#[derive(serde_derive::Deserialize, Eq, PartialEq, Debug)]
44
struct Container<T> {
55
inner: T,
66
}
77

8-
#[derive(serde::Deserialize, Eq, PartialEq, Debug)]
8+
#[derive(serde_derive::Deserialize, Eq, PartialEq, Debug)]
99
struct Unsigned {
1010
unsigned: u16,
1111
}

0 commit comments

Comments
 (0)