Skip to content

feat(assert): test interactive prompt commands via assert_exec#633

Merged
Chemaclass merged 2 commits intomainfrom
feat/301-test-prompt-commands
Apr 19, 2026
Merged

feat(assert): test interactive prompt commands via assert_exec#633
Chemaclass merged 2 commits intomainfrom
feat/301-test-prompt-commands

Conversation

@Chemaclass
Copy link
Copy Markdown
Member

🤔 Background

Related #301

Bashunit had no idiomatic way to drive commands that read from stdin (interactive prompts). This extends the existing assert_exec primitive so the Laravel-style expectsQuestion / expectsOutput / doesntExpectOutput / assertExitCode flow can be expressed in a single call.

💡 Changes

  • Add --stdin flag to assert_exec to pipe input into the command under test
  • Add --stdout-contains / --stdout-not-contains / --stderr-contains / --stderr-not-contains for substring assertions on captured output
  • Cover new flags with success + failure unit tests in assert_advanced_test.sh
  • Document the new flags and an interactive example in docs/assertions.md and refresh the bashunit doc snapshot

Add --stdin, --stdout-contains, --stdout-not-contains, --stderr-contains
and --stderr-not-contains flags to assert_exec so interactive commands
that read from stdin can be exercised from tests and output can be
asserted via substring match.

Closes #301
@Chemaclass Chemaclass added the enhancement New feature or request label Apr 19, 2026
@Chemaclass Chemaclass self-assigned this Apr 19, 2026
@Chemaclass Chemaclass added the enhancement New feature or request label Apr 19, 2026
@Chemaclass Chemaclass enabled auto-merge (squash) April 19, 2026 15:56
@Chemaclass Chemaclass merged commit 0d1a6d3 into main Apr 19, 2026
30 checks passed
@Chemaclass Chemaclass deleted the feat/301-test-prompt-commands branch April 19, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants