Skip to content
Open
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
61 changes: 59 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ pub enum DefaultTargetType {
pub struct Settings {
#[serde(default)]
default_target_type: DefaultTargetType,
#[serde(default)]
recurse: bool,
}

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -348,8 +350,8 @@ fn merge_configuration_files(
files: Files::default(),
variables: Variables::default(),
packages: packages_map,
recurse: true,
settings: Settings::default(),
recurse: global.settings.recurse,
settings: global.settings.clone(),
};

// Merge all the packages
Expand Down Expand Up @@ -827,4 +829,59 @@ mod test {
&FileTarget::Symbolic(PathBuf::from("~/.SliverBodacious").into())
);
}

#[test]
fn setting_recurse_default() {
let global: GlobalConfig = toml::from_str(
r#"
[settings]

[cat]
depends = []

[cat.files]
cat = '~/.QuarticCat'
"#,
)
.unwrap();

let local: LocalConfig = toml::from_str(
r#"
packages = ['cat']
"#,
)
.unwrap();

let merged_config = merge_configuration_files(global, local, None).unwrap();

assert!(!merged_config.recurse);
}

#[test]
fn setting_recurse_true() {
let global: GlobalConfig = toml::from_str(
r#"
[settings]
recurse = true

[cat]
depends = []

[cat.files]
cat = '~/.QuarticCat'
"#,
)
.unwrap();

let local: LocalConfig = toml::from_str(
r#"
packages = ['cat']
"#,
)
.unwrap();

let merged_config = merge_configuration_files(global, local, None).unwrap();

assert!(merged_config.recurse);
}
Comment on lines +860 to +886
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a test case for explicitly setting recurse = false to ensure all three cases are covered: default (false), explicit true, and explicit false. This would make the test suite more comprehensive and verify that the setting works correctly in all scenarios.

Copilot uses AI. Check for mistakes.
}