Luigit
repositories / termux-janitor

termux-janitor

Interactive cleanup assistant for Termux: transparent, safe, confirmed disk reclamation.

owned by admin

spec/fixtures/cli/terminal.md

Raw
Rendered preview

Terminal admission

Fixture: fixture-cli-terminal@1

Given

The built termux-janitor executable starts with standard input disconnected from a terminal and an empty isolated working directory. The executable receives no arguments, causing interactive mode to be attempted.

When

The executable starts.

Required invariants

  • INV-TERM-STATUS: The process exits with the failure status (code 1).
  • INV-TERM-DIAGNOSTIC: Standard error contains one concise diagnostic that names the executable, states that interactive mode requires a terminal stdin, and repeats the usage summary.

Forbidden effects

  • NO-TERM-STDOUT: Standard output remains empty.
  • NO-TERM-FIXTURE-MUTATION: The isolated working directory remains empty.

Instrumentation

try fixture.given_program("termux-janitor");
try fixture.given_standard_input(.ignored);
try fixture.given_working_directory(.empty);
try fixture.given_no_arguments();
try fixture.when_run_each();
try fixture.then_inv_term_status();
try fixture.then_inv_term_diagnostic();
try fixture.forbid_no_term_stdout();
try fixture.forbid_no_term_fixture_mutation();

Variations

Running with TERM=dumb or with TERM unset exercises the TERM‑environment checks. Running with terminal stdin/stdout present is a separate scenario.

Limitations

This fixture observes exit status, stderr, and that stdout remains empty. It does not trace system calls and therefore cannot prove that no other path was read.

# Terminal admission

**Fixture:** `fixture-cli-terminal@1`

## Given

The built `termux-janitor` executable starts with standard input disconnected from a terminal and an
empty isolated working directory. The executable receives no arguments, causing interactive mode
to be attempted.

## When

The executable starts.

## Required invariants

- **`INV-TERM-STATUS`:** The process exits with the failure status (code 1).
- **`INV-TERM-DIAGNOSTIC`:** Standard error contains one concise diagnostic that names the executable,
  states that interactive mode requires a terminal stdin, and repeats the usage summary.

## Forbidden effects

- **`NO-TERM-STDOUT`:** Standard output remains empty.
- **`NO-TERM-FIXTURE-MUTATION`:** The isolated working directory remains empty.

## Instrumentation

```zig tj-test
try fixture.given_program("termux-janitor");
try fixture.given_standard_input(.ignored);
try fixture.given_working_directory(.empty);
try fixture.given_no_arguments();
try fixture.when_run_each();
try fixture.then_inv_term_status();
try fixture.then_inv_term_diagnostic();
try fixture.forbid_no_term_stdout();
try fixture.forbid_no_term_fixture_mutation();
```

## Variations

Running with `TERM=dumb` or with `TERM` unset exercises the TERM‑environment checks. Running
with terminal stdin/stdout present is a separate scenario.

## Limitations

This fixture observes exit status, stderr, and that stdout remains empty. It does not trace
system calls and therefore cannot prove that no other path was read.