From f6fa5ae14abc170fd4cea69370b03bcb8a2de5e3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 10 Jun 2026 14:06:05 +0000 Subject: [PATCH] test: reduce and improve tests in src/compile/types.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - test_cache_memory_bool_false: add missing allowed_extensions().is_empty() assertion to match the symmetrical bool_true test - test_pr_trigger_config_empty_filters: extend to assert all 13 nullable PrFilters fields are None (was only checking 3 of 13) - test_pr_trigger_config_mode_explicit_synthetic: remove — its sole assertion (PrMode::Synthetic) is identical to test_pr_trigger_config_mode_default_synthetic; the mode-field trio (default_synthetic + explicit_policy + invalid_value_errors) fully covers the field without the redundant explicit-default variant Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/compile/types.rs | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/compile/types.rs b/src/compile/types.rs index 6b79ae9d..9cf3f6fa 100644 --- a/src/compile/types.rs +++ b/src/compile/types.rs @@ -1794,6 +1794,7 @@ Body let (fm, _) = super::super::common::parse_markdown(content).unwrap(); let cm = fm.tools.as_ref().unwrap().cache_memory.as_ref().unwrap(); assert!(!cm.is_enabled()); + assert!(cm.allowed_extensions().is_empty()); } #[test] @@ -2288,20 +2289,6 @@ triggers: ); } - #[test] - fn test_pr_trigger_config_mode_explicit_synthetic() { - let yaml = r#" -triggers: - pr: - branches: - include: [main] - mode: synthetic -"#; - let val: serde_yaml::Value = serde_yaml::from_str(yaml).unwrap(); - let tc: OnConfig = serde_yaml::from_value(val["triggers"].clone()).unwrap(); - assert_eq!(tc.pr.unwrap().mode, PrMode::Synthetic); - } - #[test] fn test_pr_trigger_config_mode_explicit_policy() { let yaml = r#" @@ -2382,10 +2369,21 @@ triggers: "#; let val: serde_yaml::Value = serde_yaml::from_str(yaml).unwrap(); let tc: OnConfig = serde_yaml::from_value(val["triggers"].clone()).unwrap(); + // `filters: {}` must produce a Some with every optional field defaulting to None let filters = tc.pr.unwrap().filters.unwrap(); assert!(filters.title.is_none()); assert!(filters.author.is_none()); + assert!(filters.source_branch.is_none()); + assert!(filters.target_branch.is_none()); + assert!(filters.commit_message.is_none()); + assert!(filters.labels.is_none()); assert!(filters.draft.is_none()); + assert!(filters.changed_files.is_none()); + assert!(filters.time_window.is_none()); + assert!(filters.min_changes.is_none()); + assert!(filters.max_changes.is_none()); + assert!(filters.build_reason.is_none()); + assert!(filters.expression.is_none()); } #[test]