Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

requirements.cli.invocation

Requirements index · View definition

evidence Valid

Requirement

habeas mdbook supports html MUST succeed, and a support query for another renderer MUST fail. An unknown command or invalid setup option combination MUST fail with a usage message. In particular, habeas agents and habeas setup --install-skills MUST fail with a usage message.

Rationale

The tests cover every obligation in requirements.cli.invocation. Each obligation maps to a scenario with a relevant assertion. I did not read implementation source.

  • habeas mdbook supports html MUST succeed: tests/cli.rs#fn[renderer_support_and_invalid_setup_option] runs mdbook supports html and asserts status.success().
  • A support query for another renderer MUST fail: the same test runs mdbook supports epub and asserts the status is not success. The requirement asks only for failure here, not a usage message, so this is enough.
  • An unknown command MUST fail with a usage message: tests/cli.rs#fn[unknown_command_fails_with_usage] runs habeas unknown. It asserts a failing status and that stderr contains “Usage: habeas”.
  • An invalid setup option combination MUST fail with a usage message: renderer_support_and_invalid_setup_option runs setup --wrong and setup --path . --install-skills. For each it asserts failure and “Usage: habeas” in stderr.
  • habeas agents and habeas setup --install-skills MUST fail with a usage message: both are run explicitly in the loop in renderer_support_and_invalid_setup_option. Each is checked for a failing status and “Usage: habeas” in stderr.

Both tests carry {test} references to the requirement, so there is no marking gap.

Inputs

Tests

Input 2: outline tests/cli.rs fn[renderer_support_and_invalid_setup_option]
  • File: tests/cli.rs
  • Selector: fn[renderer_support_and_invalid_setup_option]
  • Kind: fn
  • tests/cli.rs:3–29
// {test}`requirements.cli.invocation`
#[test]
fn renderer_support_and_invalid_setup_option() {
    let binary = env!("CARGO_BIN_EXE_habeas");
    let supported = Command::new(binary)
        .args(["mdbook", "supports", "html"])
        .output()
        .unwrap();
    assert!(supported.status.success());

    let unsupported = Command::new(binary)
        .args(["mdbook", "supports", "epub"])
        .output()
        .unwrap();
    assert!(!unsupported.status.success());

    for args in [
        ["agents"].as_slice(),
        ["setup", "--wrong"].as_slice(),
        ["setup", "--install-skills"].as_slice(),
        ["setup", "--path", ".", "--install-skills"].as_slice(),
    ] {
        let output = Command::new(binary).args(args).output().unwrap();
        assert!(!output.status.success());
        assert!(String::from_utf8_lossy(&output.stderr).contains("Usage: habeas"));
    }
}
Input 3: outline tests/cli.rs fn[unknown_command_fails_with_usage]
// {test}`requirements.cli.invocation`
// {test}`reference.cli.unknown_command`
#[test]
fn unknown_command_fails_with_usage() {
    let output = Command::new(env!("CARGO_BIN_EXE_habeas"))
        .arg("unknown")
        .output()
        .unwrap();
    assert!(!output.status.success());
    assert!(String::from_utf8_lossy(&output.stderr).contains("Usage: habeas"));
}

Other sources

Input 1: requirements selection requirements.cli.invocation
:::{req} invocation
`habeas mdbook supports html` MUST succeed, and a support query for another renderer MUST fail. An unknown command or invalid setup option combination MUST fail with a usage message. In particular, `habeas agents` and `habeas setup --install-skills` MUST fail with a usage message.
:::