use crate::subprocess_helpers::{ run_clm, stdout, assert_exit };
const VISIBLE_COMMANDS : &[ &str ] = &[
".status",
".version.show",
".version.install",
".version.guard",
".version.list",
".version.history",
".processes",
".processes.kill",
".settings.show",
".settings.get",
".settings.set",
".config",
];
#[ test ]
fn tc079_help_command_exits_0()
{
let out = run_clm( &[ ".help" ] );
assert_exit( &out, 0 );
}
#[ test ]
fn tc080_help_lists_12_commands()
{
let out = run_clm( &[ ".help" ] );
assert_exit( &out, 0 );
let text = stdout( &out );
for cmd in VISIBLE_COMMANDS
{
assert!( text.contains( cmd ), "help must list command '{cmd}'\nFull output:\n{text}" );
}
}
#[ test ]
fn tc082_help_includes_available_commands_section()
{
let out = run_clm( &[ ".help" ] );
let text = stdout( &out );
assert!( text.contains( "Version Management" ), "help must include section headers: {text}" );
}
#[ test ]
fn tc091_unknown_command_exits_1()
{
let out = run_clm( &[ ".nonexistent" ] );
assert_exit( &out, 1 );
}
#[ test ]
fn tc092_another_unknown_command_exits_1()
{
let out = run_clm( &[ ".zzz.nope" ] );
assert_exit( &out, 1 );
}
#[ test ]
fn tc093_empty_args_exits_0()
{
let out = run_clm( &[] );
assert_exit( &out, 0 );
assert!( stdout( &out ).contains( "Version Management" ), "empty args must show help" );
}
#[ test ]
fn tc094_help_exits_0_and_shows_commands()
{
let out = run_clm( &[ ".help" ] );
assert_exit( &out, 0 );
let text = stdout( &out );
for cmd in &[ ".status", ".processes", ".settings.get" ]
{
assert!( text.contains( cmd ), ".help output must mention {cmd}" );
}
}
#[ test ]
fn tc095_all_visible_commands_in_help()
{
let out = run_clm( &[ ".help" ] );
let text = stdout( &out );
for cmd in VISIBLE_COMMANDS
{
assert!( text.contains( cmd ), "help output must contain '{cmd}'\nFull output:\n{text}" );
}
}
#[ test ]
fn it9_help_contains_grouped_section_headers()
{
let out = run_clm( &[ ".help" ] );
assert_exit( &out, 0 );
let text = stdout( &out );
for header in &[ "Version Management", "Settings & Config", "Process Lifecycle", "Status" ]
{
assert!( text.contains( header ), "help must contain section header '{header}'\nFull output:\n{text}" );
}
}