Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/docbuilder/rustwide_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,7 @@ mod tests {
use crate::registry_api::ReleaseData;
use crate::storage::{CompressionAlgorithm, compression};
use crate::test::{AxumRouterTestExt, TestEnvironment, wrapper};
use pretty_assertions::assert_eq;
use std::{io, iter};
use test_case::test_case;

Expand Down Expand Up @@ -1979,21 +1980,25 @@ mod tests {
#[ignore]
fn test_no_implicit_features_for_optional_dependencies_with_dep_syntax() {
wrapper(|env| {
let crate_ = "stylish-core";
let version = "0.1.1";
let mut builder = RustwideBuilder::init(env).unwrap();
builder.update_toolchain()?;
assert!(
builder
.build_package(crate_, version, PackageKind::CratesIo, false)?
.build_local_package(Path::new("tests/crates/optional-dep"))?
.successful
);

assert!(
!get_features(env, crate_, version)?
assert_eq!(
get_features(env, "optional-dep", "0.0.1")?
.unwrap()
.iter()
.any(|f| f.name == "with_builtin_macros")
.map(|f| f.name.to_owned())
.sorted()
.collect_vec(),
// "regex" feature is not in the list,
// because we don't have implicit features for optional dependencies
// with `dep` syntax any more.
vec!["alloc", "default", "optional_regex", "std"]
);

Ok(())
Expand Down
13 changes: 13 additions & 0 deletions tests/crates/optional-dep/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "optional-dep"
version = "0.0.1"
edition = "2024"

[features]
default = ["std"]
std = ["alloc"]
alloc = []
optional_regex = ["dep:regex"]

[dependencies]
regex = { version = "1.11.3", optional = true }
Empty file.
Loading