cli

Command-line interface for Radroots
git clone https://radroots.dev/git/cli.git
Log | Files | Refs | README | LICENSE

commit 807f52bb87a2a6bf32f97653c2cd18f2fe47a4fd
parent 13df64947d1df67f045ac107d35663a9f53f1c85
Author: triesap <tyson@radroots.org>
Date:   Fri,  3 Jul 2026 21:05:14 +0000

cli: prove output format parser behavior

Expand runtime config tests to accept terminal, json, and ndjson from RADROOTS_CLI_OUTPUT_FORMAT.

Assert the removed human output value fails without adding aliases.

Diffstat:
Msrc/runtime/config.rs | 33+++++++++++++++++++++++++++------
1 file changed, 27 insertions(+), 6 deletions(-)

diff --git a/src/runtime/config.rs b/src/runtime/config.rs @@ -3503,15 +3503,36 @@ RADROOTS_CLI_PATHS_REPO_LOCAL_ROOT=.local/radroots/dev } #[test] - fn env_output_accepts_ndjson() { + fn runtime_config_output_format_accepts_current_contract_values_and_rejects_human() { + for (value, expected) in [ + ("terminal", OutputFormat::Terminal), + ("json", OutputFormat::Json), + ("ndjson", OutputFormat::Ndjson), + ] { + let args = runtime_args(); + let env = MapEnvironment::new(BTreeMap::from([( + "RADROOTS_CLI_OUTPUT_FORMAT".to_owned(), + value.to_owned(), + )])); + + let resolved = + RuntimeConfig::resolve_with_env_file(&args, &env, &EnvFileValues::default()) + .expect("resolve runtime config"); + assert_eq!(resolved.output.format, expected); + } + let args = runtime_args(); let env = MapEnvironment::new(BTreeMap::from([( "RADROOTS_CLI_OUTPUT_FORMAT".to_owned(), - "ndjson".to_owned(), + "human".to_owned(), )])); - - let resolved = RuntimeConfig::resolve_with_env_file(&args, &env, &EnvFileValues::default()) - .expect("resolve runtime config"); - assert_eq!(resolved.output.format, OutputFormat::Ndjson); + let error = RuntimeConfig::resolve_with_env_file(&args, &env, &EnvFileValues::default()) + .expect_err("human output format must stay removed"); + let message = error.to_string(); + assert!(message.contains("RADROOTS_CLI_OUTPUT_FORMAT")); + assert!(message.contains("terminal")); + assert!(message.contains("json")); + assert!(message.contains("ndjson")); + assert!(message.contains("human")); } }