File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,7 @@ mod registry_overlay;
164164mod rename_deps;
165165mod replace;
166166mod required_features;
167+ mod resolve_optional_dependency;
167168mod run;
168169mod rust_version;
169170mod rustc;
Original file line number Diff line number Diff line change 1+ use crate :: prelude:: * ;
2+ use cargo_test_support:: project;
3+
4+ #[ cfg( target_os = "linux" , target_arch = "x86_64" ) ]
5+ #[ cargo_test]
6+ fn cargo_test_should_not_demand_not_required_dep ( ) {
7+ let p = project ( )
8+ . file (
9+ "Cargo.toml" ,
10+ r#"
11+ [package]
12+ name = "sample"
13+ version = "0.1.0"
14+ edition = "2024"
15+
16+ [features]
17+ default = ["feat"]
18+ feat = ["dep:ipconfig"]
19+
20+ [target.'cfg(windows)'.dependencies]
21+ ipconfig = { version = "0.3.2", optional = true }
22+
23+ [[example]]
24+ name = "demo"
25+ required-features = ["feat"]
26+ "# ,
27+ )
28+ . file ( "src/main.rs" , "fn main() {}" )
29+ . file ( "examples/demo.rs" , "fn main() {}" )
30+ . build ( ) ;
31+
32+ p. cargo ( "fetch --target=x86_64-unknown-linux-gnu" ) . run ( ) ;
33+ p. cargo ( "test --target=x86_64-unknown-linux-gnu --frozen" )
34+ . run ( ) ;
35+ }
You can’t perform that action at this time.
0 commit comments