use std::path::PathBuf;
use std::process::Command;
#[test]
fn plugin_without_host_feature_does_not_pull_libloading() {
let manifest =
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../tests/test-plugin-smoke/Cargo.toml");
let output = Command::new("cargo")
.arg("tree")
.arg("--manifest-path")
.arg(&manifest)
.args([
"-p",
"test-plugin-smoke",
"--edges",
"normal",
"--prefix",
"none",
])
.output()
.expect("failed to run cargo tree");
assert!(
output.status.success(),
"cargo tree failed:\nstdout: {}\nstderr: {}",
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr),
);
let tree = String::from_utf8_lossy(&output.stdout);
let has_libloading = tree
.lines()
.any(|line| line.trim_start().starts_with("libloading "));
assert!(
!has_libloading,
"test-plugin-smoke (no `host` feature) pulls libloading in its dep tree. \
Either the `host` feature was accidentally enabled by default, or a \
non-optional dependency on fidius-host was introduced in the fidius facade crate.\n\
Full dep tree:\n{}",
tree
);
}