use super::*; use pretty_assertions::assert_eq; #[test] fn resume_parses_prompt_after_global_flags() { const PROMPT: &str = "echo resume-with-global-flags-after-subcommand"; let cli = Cli::parse_from([ "codex-exec", "resume", "--last", "--json", "--model", "gpt-5.2-codex", "--dangerously-bypass-approvals-and-sandbox", "--skip-git-repo-check", "--ephemeral", PROMPT, ]); assert!(cli.ephemeral); let Some(Command::Resume(args)) = cli.command else { panic!("expected resume command"); }; let effective_prompt = args.prompt.clone().or_else(|| { if args.last { args.session_id.clone() } else { None } }); assert_eq!(effective_prompt.as_deref(), Some(PROMPT)); } #[test] fn resume_accepts_output_last_message_flag_after_subcommand() { const PROMPT: &str = "echo resume-with-output-file"; let cli = Cli::parse_from([ "codex-exec", "resume", "session-123", "-o", "/tmp/resume-output.md", PROMPT, ]); assert_eq!( cli.last_message_file, Some(PathBuf::from("/tmp/resume-output.md")) ); let Some(Command::Resume(args)) = cli.command else { panic!("expected resume command"); }; assert_eq!(args.session_id.as_deref(), Some("session-123")); assert_eq!(args.prompt.as_deref(), Some(PROMPT)); }