//! Tests for multi-file configuration loader.

use cfgmatic::{MergeBehavior, MultiFileConfigLoader};
use cfgmatic_files::MergeOptions;
use cfgmatic_paths::{ConfigFileRule, ConfigRuleSet};

#[test]
fn test_loader_creation() {
    let loader = MultiFileConfigLoader::new("testapp");
    assert_eq!(loader.app_name, "testapp");
}

#[test]
fn test_loader_with_rules() {
    let rules = ConfigRuleSet::builder()
        .main_file(ConfigFileRule::toml("config"))
        .build();

    let loader = MultiFileConfigLoader::new("testapp").rules(rules);
    assert!(loader.rules.is_some());
}

#[test]
fn test_loader_with_merge_options() {
    let opts = MergeOptions::deep();
    let loader = MultiFileConfigLoader::new("testapp").merge_options(opts);
    assert_eq!(loader.merge_options.behavior, MergeBehavior::Deep);
}
