Lightweight coding agent that runs in your terminal
Rust
Keep feature tests focused on behavior (#33864)
jif7c4aaf28c253
diff --git a/codex-rs/exec/src/lib_tests.rs b/codex-rs/exec/src/lib_tests.rsindex 3919b39b39..568d6ad10e 100644--- a/codex-rs/exec/src/lib_tests.rs+++ b/codex-rs/exec/src/lib_tests.rs@@ -23,11 +23,6 @@ fn test_tracing_subscriber() -> impl tracing::Subscriber + Send + Sync {tracing_subscriber::registry().with(tracing_opentelemetry::layer().with_tracer(tracer))}-#[test]-fn exec_defaults_analytics_to_enabled() {- assert_eq!(DEFAULT_ANALYTICS_ENABLED, true);-}-#[derive(Clone)]struct TestLogWriter {buffer: Arc<Mutex<Vec<u8>>>,diff --git a/codex-rs/features/src/tests.rs b/codex-rs/features/src/tests.rsindex 6e028fa984..6e1ad737a1 100644--- a/codex-rs/features/src/tests.rs+++ b/codex-rs/features/src/tests.rs@@ -54,57 +54,6 @@ fn default_enabled_features_are_stable() {}}-#[test]-fn use_legacy_landlock_is_deprecated_and_disabled_by_default() {- assert_eq!(Feature::UseLegacyLandlock.stage(), Stage::Deprecated);- assert_eq!(Feature::UseLegacyLandlock.default_enabled(), false);-}--#[test]-fn use_linux_sandbox_bwrap_is_removed_and_disabled_by_default() {- assert_eq!(Feature::UseLinuxSandboxBwrap.stage(), Stage::Removed);- assert_eq!(Feature::UseLinuxSandboxBwrap.default_enabled(), false);-}--#[test]-fn undo_is_removed_and_disabled_by_default() {- assert_eq!(Feature::GhostCommit.stage(), Stage::Removed);- assert_eq!(Feature::GhostCommit.default_enabled(), false);-}--#[test]-fn image_detail_original_is_removed_and_disabled_by_default() {- assert_eq!(Feature::ImageDetailOriginal.stage(), Stage::Removed);- assert_eq!(Feature::ImageDetailOriginal.default_enabled(), false);-}--#[test]-fn apply_patch_freeform_is_removed_and_disabled_by_default() {- assert_eq!(Feature::ApplyPatchFreeform.stage(), Stage::Removed);- assert_eq!(Feature::ApplyPatchFreeform.default_enabled(), false);- assert_eq!(- feature_for_key("apply_patch_freeform"),- Some(Feature::ApplyPatchFreeform)- );-}--#[test]-fn plugin_hooks_is_removed_and_disabled_by_default() {- assert_eq!(Feature::PluginHooks.stage(), Stage::Removed);- assert_eq!(Feature::PluginHooks.default_enabled(), false);- assert_eq!(feature_for_key("plugin_hooks"), Some(Feature::PluginHooks));-}--#[test]-fn external_migration_is_removed_and_disabled_by_default() {- assert_eq!(Feature::ExternalMigration.stage(), Stage::Removed);- assert_eq!(Feature::ExternalMigration.default_enabled(), false);- assert_eq!(- feature_for_key("external_migration"),- Some(Feature::ExternalMigration)- );-}-#[test]fn removed_apps_mcp_path_override_shapes_are_ignored() {let features = [@@ -136,52 +85,6 @@ fn code_mode_only_requires_code_mode() {assert_eq!(features.enabled(Feature::CodeMode), true);}-#[test]-fn code_mode_host_is_stable_and_enabled_by_default() {- assert_eq!(Feature::CodeModeHost.stage(), Stage::Stable);- assert_eq!(Feature::CodeModeHost.default_enabled(), true);- assert_eq!(- feature_for_key("code_mode_host"),- Some(Feature::CodeModeHost)- );-}--#[test]-fn guardian_approval_is_stable_and_enabled_by_default() {- let spec = Feature::GuardianApproval.info();-- assert_eq!(spec.stage, Stage::Stable);- assert_eq!(Feature::GuardianApproval.default_enabled(), true);-}--#[test]-fn request_permissions_is_under_development() {- assert_eq!(- Feature::ExecPermissionApprovals.stage(),- Stage::UnderDevelopment- );- assert_eq!(Feature::ExecPermissionApprovals.default_enabled(), false);-}--#[test]-fn request_permissions_tool_is_under_development() {- assert_eq!(- Feature::RequestPermissionsTool.stage(),- Stage::UnderDevelopment- );- assert_eq!(Feature::RequestPermissionsTool.default_enabled(), false);-}--#[test]-fn terminal_resize_reflow_is_removed_and_enabled_by_default() {- assert_eq!(- feature_for_key("terminal_resize_reflow"),- Some(Feature::TerminalResizeReflow)- );- assert_eq!(Feature::TerminalResizeReflow.stage(), Stage::Removed);- assert_eq!(Feature::TerminalResizeReflow.default_enabled(), true);-}-#[test]fn from_sources_ignores_removed_terminal_resize_reflow_feature_key() {let features_toml = FeaturesToml::from(BTreeMap::from([(@@ -203,86 +106,7 @@ fn from_sources_ignores_removed_terminal_resize_reflow_feature_key() {}#[test]-fn tool_suggest_is_stable_and_enabled_by_default() {- assert_eq!(Feature::ToolSuggest.stage(), Stage::Stable);- assert_eq!(Feature::ToolSuggest.default_enabled(), true);-}--#[test]-fn network_proxy_is_experimental_and_disabled_by_default() {- assert_eq!(- feature_for_key("network_proxy"),- Some(Feature::NetworkProxy)- );- assert!(matches!(- Feature::NetworkProxy.stage(),- Stage::Experimental { .. }- ));- assert_eq!(Feature::NetworkProxy.default_enabled(), false);-}--#[test]-fn tool_search_is_removed_and_disabled_by_default() {- assert_eq!(Feature::ToolSearch.stage(), Stage::Removed);- assert_eq!(Feature::ToolSearch.default_enabled(), false);- assert_eq!(feature_for_key("tool_search"), Some(Feature::ToolSearch));-}--#[test]-fn secret_auth_storage_defaults_to_windows_only() {- assert_eq!(Feature::SecretAuthStorage.stage(), Stage::Stable);- assert_eq!(Feature::SecretAuthStorage.default_enabled(), cfg!(windows));- assert_eq!(- feature_for_key("secret_auth_storage"),- Some(Feature::SecretAuthStorage)- );-}--#[test]-fn browser_controls_are_stable_and_enabled_by_default() {- assert_eq!(Feature::InAppBrowser.stage(), Stage::Stable);- assert_eq!(Feature::InAppBrowser.default_enabled(), true);- assert_eq!(- feature_for_key("in_app_browser"),- Some(Feature::InAppBrowser)- );-- assert_eq!(Feature::BrowserUse.stage(), Stage::Stable);- assert_eq!(Feature::BrowserUse.default_enabled(), true);- assert_eq!(feature_for_key("browser_use"), Some(Feature::BrowserUse));-- assert_eq!(Feature::BrowserUseExternal.stage(), Stage::Stable);- assert_eq!(Feature::BrowserUseExternal.default_enabled(), true);- assert_eq!(- feature_for_key("browser_use_external"),- Some(Feature::BrowserUseExternal)- );-- assert_eq!(Feature::ComputerUse.stage(), Stage::Stable);- assert_eq!(Feature::ComputerUse.default_enabled(), true);- assert_eq!(feature_for_key("computer_use"), Some(Feature::ComputerUse));-}--#[test]-fn use_linux_sandbox_bwrap_is_a_removed_feature_key() {- assert_eq!(- feature_for_key("use_legacy_landlock"),- Some(Feature::UseLegacyLandlock)- );- assert_eq!(- feature_for_key("use_linux_sandbox_bwrap"),- Some(Feature::UseLinuxSandboxBwrap)- );-}--#[test]-fn image_generation_is_stable_and_extension_alias_is_supported() {- assert_eq!(Feature::ImageGeneration.stage(), Stage::Stable);- assert_eq!(Feature::ImageGeneration.default_enabled(), true);- assert_eq!(- feature_for_key("image_generation"),- Some(Feature::ImageGeneration)- );+fn image_generation_extension_alias_is_supported() {assert_eq!(feature_for_key("imagegenext"),Some(Feature::ImageGeneration)@@ -338,61 +162,6 @@ fn use_legacy_landlock_config_records_deprecation_notice() {);}-#[test]-fn image_detail_original_is_a_removed_feature_key() {- assert_eq!(- feature_for_key("image_detail_original"),- Some(Feature::ImageDetailOriginal)- );-}--#[test]-fn js_repl_features_are_removed_feature_keys() {- assert_eq!(Feature::JsRepl.stage(), Stage::Removed);- assert_eq!(Feature::JsRepl.default_enabled(), false);- assert_eq!(feature_for_key("js_repl"), Some(Feature::JsRepl));-- assert_eq!(Feature::JsReplToolsOnly.stage(), Stage::Removed);- assert_eq!(Feature::JsReplToolsOnly.default_enabled(), false);- assert_eq!(- feature_for_key("js_repl_tools_only"),- Some(Feature::JsReplToolsOnly)- );-}--#[test]-fn tool_call_mcp_elicitation_is_stable_and_enabled_by_default() {- assert_eq!(Feature::ToolCallMcpElicitation.stage(), Stage::Stable);- assert_eq!(Feature::ToolCallMcpElicitation.default_enabled(), true);-}--#[test]-fn auth_elicitation_is_stable_and_enabled_by_default() {- assert_eq!(Feature::AuthElicitation.stage(), Stage::Stable);- assert_eq!(Feature::AuthElicitation.default_enabled(), true);- assert_eq!(- feature_for_key("auth_elicitation"),- Some(Feature::AuthElicitation)- );-}--#[test]-fn mentions_v2_is_stable_and_enabled_by_default() {- assert_eq!(Feature::MentionsV2.stage(), Stage::Stable);- assert_eq!(Feature::MentionsV2.default_enabled(), true);- assert_eq!(feature_for_key("mentions_v2"), Some(Feature::MentionsV2));-}--#[test]-fn remote_control_is_removed_and_disabled_by_default() {- assert_eq!(Feature::RemoteControl.stage(), Stage::Removed);- assert_eq!(Feature::RemoteControl.default_enabled(), false);- assert_eq!(- feature_for_key("remote_control"),- Some(Feature::RemoteControl)- );-}-#[test]fn remote_control_config_is_ignored() {let mut entries = BTreeMap::new();@@ -404,20 +173,8 @@ fn remote_control_config_is_ignored() {assert_eq!(features.enabled(Feature::RemoteControl), false);}-#[test]-fn workspace_dependencies_is_stable_and_enabled_by_default() {- assert_eq!(Feature::WorkspaceDependencies.stage(), Stage::Stable);- assert_eq!(Feature::WorkspaceDependencies.default_enabled(), true);- assert_eq!(- feature_for_key("workspace_dependencies"),- Some(Feature::WorkspaceDependencies)- );-}-#[test]fn telepathy_is_legacy_alias_for_chronicle() {- assert_eq!(Feature::Chronicle.stage(), Stage::UnderDevelopment);- assert_eq!(Feature::Chronicle.default_enabled(), false);assert_eq!(feature_for_key("chronicle"), Some(Feature::Chronicle));assert_eq!(feature_for_key("telepathy"), Some(Feature::Chronicle));}@@ -434,18 +191,6 @@ fn codex_hooks_is_legacy_alias_for_hooks() {assert_eq!(feature_for_key("codex_hooks"), Some(Feature::CodexHooks));}-#[test]-fn multi_agent_is_stable_and_enabled_by_default() {- assert_eq!(Feature::Collab.stage(), Stage::Stable);- assert_eq!(Feature::Collab.default_enabled(), true);-}--#[test]-fn enable_fanout_is_under_development() {- assert_eq!(Feature::SpawnCsv.stage(), Stage::UnderDevelopment);- assert_eq!(Feature::SpawnCsv.default_enabled(), false);-}-#[test]fn enable_fanout_normalization_enables_multi_agent_one_way() {let mut enable_fanout_features = Features::with_defaults();diff --git a/codex-rs/utils/sleep-inhibitor/src/linux_inhibitor.rs b/codex-rs/utils/sleep-inhibitor/src/linux_inhibitor.rsindex e97d42b223..e29c7bdbb2 100644--- a/codex-rs/utils/sleep-inhibitor/src/linux_inhibitor.rs+++ b/codex-rs/utils/sleep-inhibitor/src/linux_inhibitor.rs@@ -228,13 +228,3 @@ fn spawn_backend(backend: LinuxBackend) -> Result<Child, std::io::Error> {fn child_exited(error: &std::io::Error) -> bool {matches!(error.kind(), std::io::ErrorKind::InvalidInput)}--#[cfg(test)]-mod tests {- use super::BLOCKER_SLEEP_SECONDS;-- #[test]- fn sleep_seconds_is_i32_max() {- assert_eq!(BLOCKER_SLEEP_SECONDS, format!("{}", i32::MAX));- }-}