use std::fs;
fn manifest() -> String {
fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/Cargo.toml"))
.expect("Cargo.toml must be readable")
}
fn fantoccini_line(manifest: &str) -> String {
manifest
.lines()
.find(|line| line.trim_start().starts_with("fantoccini"))
.unwrap_or_else(|| panic!("Cargo.toml must declare a fantoccini dependency"))
.to_string()
}
#[test]
fn fantoccini_is_taken_without_default_features() {
let line = fantoccini_line(&manifest());
assert!(
line.contains("default-features = false"),
"fantoccini must be taken with `default-features = false` so its \
`native-tls` default does not force openssl-sys on consumers; got: {line}"
);
}
#[test]
fn fantoccini_uses_rustls() {
let line = fantoccini_line(&manifest());
assert!(
line.contains("\"rustls-tls\""),
"fantoccini must enable `rustls-tls` to keep a working TLS stack; got: {line}"
);
assert!(
!line.contains("\"native-tls\""),
"fantoccini must not enable `native-tls` by default; got: {line}"
);
}
#[test]
fn native_tls_is_available_as_an_opt_in_feature() {
let manifest = manifest();
assert!(
manifest.contains("native-tls = [\"fantoccini/native-tls\"]"),
"the system TLS stack must stay reachable as an opt-in `native-tls` feature"
);
}
#[test]
fn default_feature_set_is_empty() {
let manifest = manifest();
assert!(
manifest.contains("default = []"),
"the default feature set must stay empty so no TLS backend is forced on consumers"
);
}